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)"); } |