字体: | 推荐给好友 上一篇 | 下一篇

关于Director与Flash之间的通讯!

发布: 2010-7-03 16:53 | 作者: 干海棠 | 来源: 网络转载 | 查看: 218次


Flash To Director的信息传递:
一般来说,FlashDirector传递消息有下面三个方法:
(1)在flash中可以通过Geturl函数直接调用Director的Lingo命令,如
on (rollover)
{ geturl (‘‘lingo:cursor 280‘‘);} 
on (rollout)
{ geturl (‘‘lingo:cursor 0‘‘);} 
将上面的actionscript加在flash按钮上,然后将其导入到Director中就能实现光标的变换了。
********
注:当然也可以用lingo:gotonetpage来打开超级连接。

(2)使用flash中的event命令,如:
geturl (“event:readtxt,\”aa.txt\”,\”dairy\””)
上面的actionscript可以执行director中的影片脚本中的readtxt函数,并传递“aa.txt”和“dairy”两个参数给readtxt函数。

(3)在Flash中通过Geturl传送参数给Director,在Director中接受Flash传递的参数,然后执行相应的lingo命令,如:
在flash的按钮上加入下面的ctionscript
On (Release) 
Get URL ("botton1") 
End On 
然后在DR的moviescript中,使用geturl函数执行相应的lingo命令: 
on geturl me,kk –kk为geturl函数的参数
case kk of 
"botton1": go to frame "Mark1" 
"botton2": go to frame "Mark2" 
end case
end geturl

Director To Flash的信息传递:
在Director中对flash的信息传递的指令相对要丰富得多
(1)在Director中控制flash演员播放、停止等命令
sprite(FlashSpriteNum).play() --播放 flash 演员
sprite(FlashSpriteNum).stop() –停止flash演员的播放
类似的函数有 rewind()、gotoframe() 等等,其详细的用法见前面的“控制flash”。

(2)使用getVariable函数来直接获取flash演员中的值 
getVariable(sprite FlashSpriteNum, “password”) 
--获取位于通道FlashSpriteNum中的flash演员中变量password的值

(3)使用setVariable函数来设置flash演员中的值
setVariable(sprite FlashSpriteNum, “password”, “admin”)
--将位于通道FlashSpriteNum中flash演员中的password变量的值设置为admin

TAG: director flash 技巧

 

评分:0

我来说两句

Creative Commons License本站作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
欢迎向站长短信举报非法信息,站长短信接收平台:+ 086 138 6514 1572