当前位置:首页>网络学院>多媒体教程>Director教程>文章内容

flash和director之间的沟通技巧

[ 来源: | 作者: | 时间:2007-07-22 | 收藏 | 推荐 ] 【

  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的值 www.it55.com
  
c 设置flash消息传递机制(flash to director)
  
  sprite(1).eventPassMode = #passNotButton
  
参数说明
  #passAlways (缺省)—一随时传递消息
  #passButton—当flash中的一个按钮按下后才传递消息
  #passNotButton—当flash中的一个非按钮的任何物件按下时传递消息
  #passNever—不传递任何消息

note:

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

(编辑:IT资讯之家 www.it55.com

返回顶部
 

网友评论

[以下评论为网友观点,不代表本站。请自觉遵守互联网相关政策法规,所有连带责任均有评论者自负。]
[不超过250字]