4月 29

js调用flash中的方法

Posted by cwy104 at 16:40 | 程序·人生 | 评论(8) | 阅读(3220) | |

在 Flash 中与 JS 的通信可以用传统的 getURL,Flash8 以后,可以用 ExternalInterface 。ExternalInterface 在功能上与 fscommand()、CallFrame() 和 CallLabel() 方法相似,但它更灵活、更通用。推荐对 JavaScript 和 ActionScript 之间的通讯使用 ExternalInterface 。

ExternalInterface方式:

import flash.external.ExternalInterface;//导入 ExternalInterface 类

ExternalInterface.addCallback("setMsg", setMsg);//定义JS调用的方法名

protected function setMsg(msg:String):String//定义方法
   {  }

注意:如果要使用 ExternalInterface,当前帧必需要有 import flash.external.ExternalInterface; 或者 import flash.external.*;

 

acboy Homepage
2010年5月6日 11:22
学习了……嘿嘿
黑子
2011年1月9日 18:40
airmax Email Homepage
2011年1月10日 16:28
很不错哦,挺好的。
running shoes Email Homepage
2011年2月2日 00:14
nike air force one stilettos
Christian Louboutin Discount Email Homepage
2012年2月23日 13:39
nice posts
sac louis vuitton Email Homepage
2012年4月26日 09:41
Infestations of the mountain pine beetle have already reduced the lumber supply in B.C., and other sawmills destroyed by fire in recent years have not been rebuilt.
sac hermes oas cher Email Homepage
2012年5月15日 15:57
There was a theory the Lakers might have a chance to steal Game 1 because Oklahoma City has not played in more than a week.
louis vuitton pa Email Homepage
2012年5月15日 15:59
Freese's wild throw to first in a bid for a double play on another bunt allowed an insurance run to score in the ninth against Boggs.
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
 昵称  
 网址
 电邮