eNet学院俱乐部


 
标题: Director疑难解答(7)
小小郭姑娘
上等兵
Rank: 3Rank: 3Rank: 3



UID 2391356
精华 1
积分 557
帖子 36
威望 379
积分 25
阅读权限 30
注册 2007-7-4
状态 离线
发表于 2007-7-4 16:19  资料 短消息 
Director疑难解答(7)

01. 我能否在我的Director文件中制造一个屏幕保护程序?

   [A] 这是一种方法,但它也许需要一些调整。例如,它实际上并不支持在文件的屏保中使用动画。不管怎样,随着你对程序创造性地增加,你

   至少能够使这个屏保在屏幕上随机出现所选择的文字。你也可以使用一个或几个精灵在木偶化制成动画。

--电影脚本的开头

GLOBAL gnLastFrame, glLastMouseLoc

--把以下语句加入你的Startmovie()事件处理过程中

set the timeoutLength to 60 * 60 * 5

--这行意思是:一秒分为60个滴答,60个滴答×60=1分钟,1分钟×5=5分钟。(也就是启动屏保时间为5分钟)

when timeOut then ScreenSaver()

--把以下的语句加入电影脚本中

on ScreenSaver

put the frame into gnLastFrame

put the mouseLoc into glLastMouseLoc

go "loopFrame"

END ScreenSaver

--标记“loopFrame”处放置的是你想要作为屏保的动画或随机出现的文字

--请注意,将以下语句放置在标记"loopFrame" 处的帧脚本中

on exitFrame

   CheckUserEvent()

end

--把以下的语句加入电影脚本中

on CheckUserEvent

   when keyDown then ExitSaver()

if the mouseLoc <> glLastMouseLoc then ExitSaver()

go the frame

END CheckUserEvent

--把以下的语句加入电影脚本中

on ExitSaver

go gnLastFrame

   when keyDown then nothing

abort

END ExitSaver

02. 当显示分辨率比我的Director文件所制定的舞台大时,我该怎样用指定的背景颜色把显示器空白部分填满?

   [A] 有两种解决的方法。一种是在创建你的放映机时,选中option中FULL SCREEN。这样做的优点是很容易就能做到,但是,它最明显的缺点就是不一定是在你的客户的屏幕中间。此外,可以看来是你的发展文件里的“屏幕”的事情能在如果他们是对权利和底部的“屏幕”出现于编辑的放开上好好地结束了。

   另外一种方法是使用Movie In A Window(MIAW)从窗口中调用外部文件。这需要在一些地方编程序而且也更难;但是结果将更令人满意。
这里是一种一般的处理方法。带新局长的开始做成文件,新建一个新的Director文件,并且将它的舞台颜色设置为你所喜欢的背景颜色。

   接着,在分镜表的帧1中,定义下列脚本:

on exitFrame

pause

end

   之后,把下列语句加入电影脚本。

GLOBAL goFileWindow, gsWindowName, gaFileWindowRect, gsWindowPath, gsSizeOfWindow

on StartMovie

   SetUpWindowSpecs()

   LaunchMIAW()

END StartMovie

on StopMovie

   PurgeMIAW()

unload

END StopMovie

on SetUpWindowSpecs

-- inits dimensions and origins for MIAW object over splash screen

-- plug in your own names below

-- note you do not have to specify ".dxr" or ".dir" for the path to the external file

-- this can really be any name you want; it』s an internal reference

set gsWindowName to "intro"

-- this is the actual MIAW file you want opened by the stub

set gsWindowPath to ( the pathName & "intro" )

put ( the stageRight / 2 ) into nHorizontalCenterOfMonitor

put ( the stageBottom / 2 ) into nVerticalCenterOfMonitor

-- set dims for location of window relative to screen size

set nWindowWidth = nHorizontalCenterOfMonitor + 320

set nWindowHeight = nVerticalCenterOfMonitor + 240

set nHorizOrigin = nWindowWidth - 640

set nVertOrigin = nWindowHeight - 480

set gaFileWindowRect = rect ( nHorizOrigin, nVertOrigin, nWindowWidth, nWindowHeight )

END SetUpWindowSpecs

on LaunchMIAW

if objectP ( goFileWindow ) then forget goFileWindow

set goFileWindow to window gsWindowName

set the rect of goFileWindow to gaFileWindowRect

set the fileName of goFileWindow to gsWindowPath

set the title of window "intro" = "My Presentation"

set the titleVisible of goFileWindow to TRUE

-- windowType 5 is draggable on Macs; might need tweaking on PCs. Experiment.

-- take care not to allow the PC version to have a close box in its bar or you might

-- run into beaucoup problems later

set the windowType of goFileWindow = 5
open goFileWindow

END LaunchMIAW

on PurgeMIAW

if objectP ( goFileWindow ) then forget goFileWindow

END PurgeMIAW

03. “me”是什么?它意味着什么?

   [A] “me”是一个传送给一个对象脚本的内部参数,就像“on new me”等等。它是对对象在内存中的位置的描述,它包括对象本身,用于指定那个对象。我们努力去把它弄清楚。

   当一个代码对象在内存中被初始化时,它得到系统的一个存储器地址,一个关于那个内存中的对象的位置的十六进制数。“me”是一个关于这个对象和它在内存中的位置的关键字。

   可以把计算机的许多空的空间看作是公寓的空房间。

   当一个对象产生时,把它放入公寓的房间中,并且分配一个该对象居住的房间的号码 - 2 -B或13-F或其他的。这个号码的分配任务是由计算机操作系统操纵的,并且要视空闲的房间而定。换句话说,地址纯粹是任意的。你不能对你的对象物体说,进入这个已被使用的存储器地址。无论如何,这不是由lingo控制的。

   那个意味着的是在你创建对象前,没有办法能判定它会被放置在哪里。因此你必须要有一个方法去操控这个对象的位置。这就是“me”的来历。

   无论何时,“me”都被用作查询对象的位置,对象本身知道它目前被放置在什么地方,就象你知道你的家庭住址一样。

   “me”是一个能在相应位置找到相应对象的参数,而且比写这个对象在6楼13号要简短的多。

   不是在任何地方你都会在一些初始化一个对象的脚本中使用“me”,例如,在一个帧脚本中有可能不用包括“me”。

on exitFrame me

go the frame

end

   然而由于你也许不止一次想要查阅一些行为,它也会变成一个对象, 并且更多的是一些单行的源代码,就像在一个精灵行为脚本中;建立一个对象并且把它放入内存,用这种方法来处理循环或复杂的造作,是很快的并且也是很稳定的。

on mouseEnter me

   [ do some neat stuff here] end

on mouseLeave me

   [ do other neat stuff here]

end

on mouseUp me

ALERT "Howdy, man!"

end

on rightMouseDown me

ALERT "Next time try the OTHER mouse button!"

end

   以上四种脚本都可以作为一个行为附加到同一个精灵上;因此这行为本身被附加上去后,精灵将收到以上所描述的脚本的影响。然而在这种情况下,“me”不是作为一个参数被某一指定的精灵所使用, “me”替代了附加在显示在屏幕上的精灵的行为的一个参数。自然地也能对象脚本能够被创建不能被直接附加到屏幕上的任何东西上的对象脚本。我习惯于使用这样的项目,例如,建立交互式的警告或信息对话框,通过对对象传递参数来指出要显示什么,并且返回主程序用户对对话框的应答的信息。

04. 我想把时间的表示形式改为时/分/秒。我该怎样做?

   [A] 非常幸运,这是相当简单的一个问题,实际上你可以使用mod函数来进行一些计算。

   取模(mod)函数是把一个数除以另一个数后,取除得的余数。

   把这弄清楚后,举个例子。

   假设你用7除以3。你所得到的是除下的余数1。

   7/ 3 = 2 1 / 3 -- the modulus is 1.

   7÷3=2……1 --模为1。

   假设你用6除以3。你所得到的模是0,因为这个除法没有余数。这样,你就可以用取模函数来完成上面的转换工作。这儿是一个简单的,需要调用你想要转换的秒数的值作为参数的脚本。

on ConvertSeconds nSeconds

--得到把秒转换成分的值,用0或不赋值会很安全。

if voidP ( nSeconds ) then

ALERT "There was no seconds parameter for me to process. Exiting function."

exit

end if

set nMinutes = nSeconds / 60

--取得“分”之后的“秒”数

set nSecondsExtra = nSeconds mod 60

--取得把分转换成小时的值

set nHours = nMinutes / 60

--取得“时”之后的“分”数

set nMinutesExtra = nMinutes mod 60

put nSeconds && "seconds equals" && nHours && "hour(s)" && nMinutesExtra && "minute(s)" && nSecondsExtra && "second(s)"
顶部
[广告] 应届毕业生如何才能找到好工作
梦铃的声音
少尉
Rank: 12Rank: 12Rank: 12


UID 2176483
精华 6
积分 15077
帖子 1311
威望 5021
积分 150
阅读权限 80
注册 2007-2-15
状态 离线
发表于 2007-7-6 15:59  资料 短消息 
哈哈 这次做沙发了
顶部
[广告] 论坛使用帮助(如何发附件)
adcd
一级士官长
Rank: 11Rank: 11Rank: 11Rank: 11Rank: 11


UID 2159826
精华 1
积分 8029
帖子 234
威望 1830
积分 35
阅读权限 70
注册 2007-2-3
状态 离线
发表于 2007-7-7 10:06  资料 短消息 
我占了板凳的说.....
顶部
[广告] 应届毕业生如何才能找到好工作
 


当前时区 GMT+8, 现在时间是 2008-11-19 13:42


Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.051601 second(s), 17 queries , Gzip enabled

清除 Cookies - 联系我们 - 硅谷动力网络学院 - Archiver - WAP