荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: guita (复杂爱), 信区: Multimedia
标  题: director应用技巧
发信站: 荔园晨风BBS站 (Tue Apr  2 17:00:34 2002), 转信

director应用技巧
--转载自5Dmedia.com
------donlee

director应用技巧
1、设置movie,使之自动缩放以适应屏幕大小
A:使用如下script:
on preparemovie
  (the stage).rect=(the desktoprectlist).[1]
  (the stage).drawrect=(the desktoprectlist).[1]
end


2、制作带阴影效果的text
field可以作出阴影效果,但在field中应用中文容易死机,我们可以用一个text
member但多个sprite,各sprite位置稍稍错开,并适当设置其blend即可。灵活使
用之可以得到动态的和彩色的阴影。缺点是数量过多会拖累速度。


3、中文菜单
可以用installmenu的标准方法生成中文菜单,但字体、字号设置全部无效。


4、filmloop播放问题:在一帧内判断一个filmloop播放完毕,再继续播放下一帧

frame script中含有以下代码,以实现"定格":
on exitframe me
go the frame
end
再把以下behavior拖到filmloop sprite即可:
on exitframe me
  --但用prepareframe不行?!
  tell sprite(me.spriteNum)
    if the frame = the lastframe then
      ploopcnt = 1
    end if
  end tell
  if ploopcnt then
    go next   --或改为其它命令
  end if
end

5、对filmloop的控制。
以下behavior的功能是用于一个filmloop sprite,点击暂停,再次点击则继续。

property ppause,pframe
on beginsprite me
ppause=false
pframe=1
end

on mouseup me
ppause=not ppause
if ppause then
tell sprite(me.spriteNum) to pframe=the frame
end if
end

on exitframe me
if ppause then
if pframe=1 then
tell sprite(me.spriteNum) to go to the lastframe
else
tell sprite(me.spriteNum) to go to pframe-1
end if
end if
end
由此我们也可以知道,我们无法使filmloop的播放速度快于movie,但可以用上法
的变通来减慢它。
补充说明:tell sprite...用法类似tell window,但尚未见于正式文档,我使用
至今,尚未见其出错。

6、在projector用lingo关闭计算机(用于Windows9X),主要用于触摸屏等无人值
守的情况等。
A:无论此时计算机是否有打开的程序或窗口,使用下面的lingo语句可直接关机:
(仅限于projector)
open "c:\windows\rundll.exe user.exe,exitwindows"
若要重新启动计算机,改为 "c:\windows\rundll.exe user.exe ,
exitwindowsexec"
当然在实际的projector中不能直接用"c:\windows",而要用fileio的
getosdirectory()等函数先获得系统相应目录。

7、在runtime动态地改为Director内置的图标
最常用和简单的方法是对于一个sprite,施与以下behavior:
on beginsprite me
  sprite(me.spriteNum).cursor=280   --手形光标
end
一般的光标设置以上一句就够了,更具个性化的光标设置这里不谈了。

内置图标(有些是相同的):0-4  200  254 256-269  271-272 280-281 284-286
290-304

8、Lingo支持递归!
用到搜索算法的朋友们应该高兴吧。

9、director中事件发生的顺序

prepareMovie
beginsprite for frame 1
stepFrame for frame 1
prepareframe for frame 1
startMovie
enterFrame for frmae 1
exitfrmae for frame 1

beginsprite for next frame

10、设置搜索路径的合适位置
A:实际上,在prepareMovie前,所用到的cast及相关的member包括其链接关系都
应作好准备。
所以不可在movie内为自身设置搜索路径。一般在stub player中设置searchpath为
佳。



------------------------------------------------------------------------
--------


--
※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.55.226]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店