flash与js交互ie跟ff通用的方法
2009-05-06 08:29
686 查看
irobot's blog
HomeArchives
Search
Tags
Comments
Tools
ChatHis
Trackbacks
Links
flash与js交互ie跟ff通用的方法
Submitted by irobot on 2009, February 14, 4:36 PM. flashXML/HTML代码
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
width=1 height=1 id="myFlash">
<param name=movie value="src/load.swf">
<param name=quality value=high>
<embed src="src/load.swf" quality=high width=1 height=1 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="myFlash" swLiveConnect="true">
</embed>
</object>
html如上,object是用的id,embed是用的name
JavaScript代码
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1)
{
return window[movieName];
} else {
return document[movieName];
}
}
如上方法返回dom对象。
修改赋值flash变量只用thisMovie('myFlash').SetVariable("run", '1');
flash支持的js可调用变量
播放动画:Play()
例:(网页中的 Flash id).Play();
停止动画:StopPlay()
动画是否正在播放:IsPlaying()
跳转到某帧:GotoFrame(frame_number)
获取动画总帧数:TotalFrames()
回传当前动画所在帧数:CurrentFrame()
使动画返回第一帧:Rewind()
放大指定区域:SetZoomRect(left,top,right,buttom)
改变动画大小:Zoom(percent)
使动画在 x,y 方向上平移:Pan(x_position,y_position,unit)
返回动画被载入的百分比:PercentLoaded()
加载动画:LoadMovie(level_number,path)
例:(网页中的 Flash id).LoadMovie(0, "***/***.swf");
movie_clip 跳转到指定帧数:TGotoFrame(movie_clip,frame_number)
例:(网页中的 Flash id).TGotoFrame("_root.实例名.次实例名",帧数);
movie_clip 跳转到指定标签:TGotoLabel(movie_clip,label_name)
例:(网页中的 Flash id).TGotoLabel("_root.实例名.次实例名","标签名");
回传 movie_clip 当前帧:TCurrentFrame(movie_clip)
回传 movie_clip 当前标签:TCurrentLabel(movie_clip)
播放 movie_clip:TPlay(movie_clip)
停止 movie_clip 的播放:TStopPlay(movie_clip)
获取变量:GetVariable(variable_name)
变量赋值:SetVariable(variable_name,value)
call 指定帧上的 action:TCallFrame(movie_clip,frame_number)
call 指定标签上的 action:TCallLabel(movie_clip,label)
获取 movie_clip 的指定属性:TGetProperty(movie_clip,property)
设置 movie_clip 的指定属性:TSetProperty(movie_clip,property,number)
*反之flash调用js
//导入ExternalInterface类
import flash.external.ExternalInterface;
//下面这个赋值一定要注意,如果是字符串,写法应该是在双引内再加单引,此前我郁闷了一天
var i:String = "’js调用flash中的方法,传递flash变量给js’";
//var i:Number = 1234;
function showAlert(){
//调用js方法jsAlert(),并将flash变量赋值给js
ExternalInterface.call("jsAlert("+i+")");
}
//允许js中的flAlert()调用flash中的showAlert()
ExternalInterface.addCallback("flAlert",null,showAlert);
相关文章推荐
- flash调用js中的方法,让js传递变量给flash (兼容 IE & FF)
- flash调用js中的方法,让js传递变量给flash (兼容 IE & FF)
- flash调用js中的方法,让js传递变量给flash (兼容 IE & FF) (转)
- flash调用js中的方法,让js传递变量给flash (兼容 IE & FF) (转)
- 在IE下FLASH背景透明而在FF下不透明的解决方法
- JavaScript js 兼容浏览器问题 兼容FireFox(FF)、IE的解决方法
- js中IE和Mozzila Firefox的一些不通用的属性方法
- IE和FF在对js支持的不同及解决方法
- 常用的兼容IE和火狐FF等浏览器的js方法
- PNG图片兼容IE和FF的解决方法—JS控制
- JS与flash交互通信控制的方法
- js通用方法检测浏览器是否已安装指定插件(IE与非IE通用)
- IE不出现Flash激活框的小发现的js实现方法
- IE网页js语法错误2行字符1、FF中正常的解决方法
- 在IE下FLASH背景透明而在FF下不透明的解决方法
- JavaScript js 兼容浏览器问题 兼容FireFox(FF)、IE的解决方法
- JS:attachEvent和addEventListener 使用方法(ff和ie)
- flash与js交互方法
- 常用的兼容IE和火狐FF等浏览器的js方法
- JS实现设置ff与ie元素绝对位置的方法