设为首页 加入收藏  
首页 >>Flash>>正文

flash和director之间的沟通技巧

作者:梁文平 上传时间:2006-10-12 14:52:51 来源:

flash和director之间的沟通技巧
   Flash 对Director来说无疑是一个最多才多艺的演员,有时候一些元素用flash来制作确实非常的方便。在一些交互性很强的项目中,难免会碰到flash元素需要和主程序相互沟通传递信息,下面就这来谈谈他们之间是如何沟通的。

1. flash to director

flash 跟director沟通主要通过下面两个办法

a. lingo

flash 中可以通过 geturl(""lingo:lingoHandler"") 来调用director的lingo 指令。

比如

on (rollover)
   { geturl (""lingo:cursor 280"");}
on (rollout)
   { geturl (""lingo:cursor 0"");}

b. event

   geturl (""event:amith,""sad"""") 执行director中影片脚本中的 amith 函数并传递 sad 参数

2. director to flash

   director中 控制 flash 元素的指令相对多些,这里仅仅列出常用到的,供参考。

a. 控制 flash 元素播放类
   sprite(1).play() --播放 falsh 演员
   类似的函数有 rewind() stop() gotoframe() 等

b 传递参数类

   getVariable(sprite 1, ""whatQues"") --取得 flash 演员中定义的变量whatQues的值

   setVariable(sprite 1, ""whatQues"", ""Animal"") --设置flash 演员中定义的变量whatQues的值

c 设置flash消息传递机制(flash to director)

   sprite(1).eventPassMode = #passNotButton

参数说明
   #passAlways (缺省)—一随时传递消息
   #passButton—当flash中的一个按钮按下后才传递消息
   #passNotButton—当flash中的一个非按钮的任何物件按下时传递消息
   #passNever—不传递任何消息

note:

   上面假定 flash 演员放在 score 中的 1 通道

版权所有:天天网络工作室 晋ICP备06006449
手机:13103416120
Email:sxlwp@163.com QQ: 170229409