FSCommand函数用法(四)
Flash?Methods函数集?
? ?看了上面的例子,你一定对Flash?Methods有所了解了吧!下面我来介绍一下Flash?Methods的全部函数:?
?Flash?Method函数?函数解释?
?Play()??使已停止了的FLASH动画在停止处开始播放?
?格式:YourMovieName.Play()?
?StopPlay()??停止正在播放的FLASH文件
??
?格式:YourMovieName.StopPlay()?
?IsPlay()??如果FLASH文件正在播放中,此函数值为true
??
?例如:if?(YourMovieName.IsPlaying)
?????alert("Playing")
?如当动画正在播放,就会弹出一个警告条。?
??
?GotoFrame(int?frameNum)??控制FLASH跳到指定的frame?
?格式:YourMovieName.GotoFrame(10)?
?TotalFrames()??传回FLASH动画的总帧数
???
?格式:YourMovieName.TotalFrames()?
?CurrentFrame()??传回FLASH动画目前所在的帧数减一
?FS?Command控制的帧都是由0开始的?
?格式:YourMovieName.CurrentFrame()+1?
?Rewind()??控制FLASH动画条会第一帧并停止?
?格式:YourMovieName.Rewind()?
?SetZoomRect(int?left,
?int?top,int?right,int?bottom)??放大指定的坐标区域(int?left=左坐标的整数;int?right为右坐标的整数
?;int?top和int?bottom分别表示上坐标和下坐标的整数)?
??
?Zoom(int?percent)??改变FLASH动画的大小。这函数只允许你将放大后的?图片缩小到原图片的大小??
?YourMovieName.Zoom(50)放大一倍
?YourMovieName.Zoom(200)缩小一倍
?YourMovieName.Zoom(0)恢复原始尺寸?
?Pan(int?x,int?y,int?mode)??平移放大后的FLASH动画。x,y表示移动目的地的x轴和y轴的坐标;int?mode表示
?表示坐标的单位,但其值为"0"时,以象数为单位,为"1"时,以百分比为单位。?
??
?PercentLoaded()?回传0~100的值,此值为浏览器载入FLASH的百分比程度。可用此功能制作loading画面?
?如:if?(YourMovieName.PercentLoaded()<100)
??YourMovieName.GotoFrame(YourMovieName.PercentLoaded())?
?LoadMovie(int?layer,String?url)?载入其他的FLASH动画,"int?layer"为level的值,数值越大,动画就放得
?越上;"string?url"为要栽入的动画的路径和名称?
?如:LoadMovie(1,?"yourmovie.swf")表示把yourmovie.swf的动画加载到原来的动画上,level为1
?LoadMovie("",?"yourmovie.swf")表示卸载yourmovie.swf动画
??
?TGotoFrame(String?target,int?frameNum)??控制动画跳到指定的movie?clip的第几帧??
?TGotoFrame("_flash0/mm",10)表示跳到instance?name为mm的movie?clip的第十帧?
?TGotoLabel(String?target,String?label)??控制动画跳到指定的movie?clip的指定的label??
?TGotoFrame("_flash0/mm","ten")?
?TCurrentFrame(String?target)?传回指定的movie?clip的当前所在帧减一??
?fras=YourMovieName.TCurrentFrame("_flash0/mm")+1?
?TCurrentLabel(String?target)?传回指定的movie?clip当前所在的label??
?label=play_movie.TCurrentLabel("_flash0/mm")?
?TPlay(String?target)??控制指定的movie?clip从停止出开始播放?
?YourMovieName.Play("_flash0/mm")?
?TStopPlay(String?target)??控制指定的movie?clip停止播放??
?YourMovieName.Play("_flash0/mm")?
?GetVariable(variable_name)?获取变量?
?SetVariable(variable_name,value)?变量赋值?
?TCallFrame(movie_clip,frame_number)?call指定帧上的action?
?TCallLabel(movie_clip,label)?call指定标签上的action?
?TGetProperty(movie_clip,property)?获取movie_clip的指定属性?
?TSetProperty(movie_clip,property,number)?设置movie_clip的指定属性?
? 需要说明的是:最后两个函数在获取movie_clip的属性时,是以0到18的数字来表示的。下面列出它们分别
?代表的意思:?
?属性?作用?数字?使用方式?
?X?Position?X坐标?0?Get,Set?
?Y?Position?Y坐标?1?Get,Set?
?X?Scale?X方向缩放比率?2?Get,Set?
?Y?Scale?Y方向缩放比率?3?Get,Set?
?CurrentFrame?movie_clip当前所在帧数?4?Get?
?TotalFrames?movie_clip总帧数?5?Get?
?Alpha?movie_clip的透明度?6?Get,Set?
?Visibility?movie_clip是否可见?7?Get,Set?
?Width?movie_clip的宽度?8?Get?
?Height?movie_clip的高度?9?Get?
?Rotation?movie_clip的旋转度?10?Get,Set?
?Target?movie_clip的路径?11?Get?
?Framesloaded?movie_clip已载入的帧数?12?Get?
?Name?movie_clip的实体名字?13?Get,Set?
?DropTarget?movie_clip的拖拽?14?Get?
?Url?包含movie_clip的动画的url?15?Get?
?HighQuality?设置画面质量为高质量?16?Get,Set?
?FocusRect?显示按钮边框?17?Get,Set?
?SoundBufTime?预设声音缓冲时间?18?Get,Set?
? 我们可以看到,FS?Command为Flash打开了一个使用脚本语言的接口,这可以弥补Flash在函数上的不足。?
?所以,利用好这个方法,将使我们在制作Flash动画时如虎添翼!
?
?□■?最后,我想说说在FLASH中如果想调用javascript(或VBscript)的另外一种方法,不需要用FS?Command,
?只需要运用getURL.?
?·?这做法为先在<head>与</head>之间写如下javascript代码:
?<script?language="javascript">?
?function?jimsons(theURL,winName,features)?{?
???window.open(theURL,winName,features);
?}
?</script>
?·?意思是定义一个jimsons()的函数,若被调用时,就打开一个新的窗口。
?函数里面有三个参数theURL是网址,winName是网页的标题,features是用来设置一些窗口特性如是否显示状态
?栏,滚动条等
?·?然后就用FLASH做一个按钮,把它拖到场景后,在按钮上写入AS
?on?(release)?{
?????getURL("javascript:jimsons(http://bbs.flash8.net',Jimsons制作
?,scrollbars=no,width=550,height=400)");
?}
??·?作用是,当按下按钮时,就从本网页中的javascript获取jimsons()这个函数。