|
主题: 关于父脚本和产生的对象的一个问题
|
 Jawry
职务:普通成员
等级:1
金币:0.0
发贴:106
|
#12001/6/5 8:57:10
首先,在提出这个问题之前,我要感谢那些对我提出的问题给予热情帮助的人们. 另外,我的问题就说:在定义了一个父脚本,脚本中有on mouseup事件,然后,再产生对象,但是这个对象并不响应这个on mouseup事件。
|
 rainy_5d
职务:普通成员
等级:2
金币:1.0
发贴:225
|
#22001/6/6 11:22:03
是个有意思的问题,我也试验了一下,开始以为是建立对象后没有具体的sprite通道,可是建立对象后,向父脚本转递通道后还是没有用。
意思就是说,dir检测不到用lingo放置到score上的the clickOn。 该如何写? 请高手指教。
|
 zain
职务:普通成员
等级:1
金币:0.0
发贴:88
|
#32001/6/6 12:39:03
hi 写在父脚本里的mouseUp等 可以响应的(我做过)。 不知道你是怎么叫这个 mouseUp 的,在哪里叫的。 简单的叫法:mouseUp new(script"xxxx") 其中“xxxx”是你的父脚本名字。 请你写的再详细些。
|
 rainy_5d
职务:普通成员
等级:2
金币:1.0
发贴:225
|
#42001/6/7 9:29:28
TO zain兄:
能把你的详细的脚本写一下吗?我试验了几次了,都不行。
另外,为何director检测不到用lingo放置到stage上的sprite的the clickOn?
|
 zain
职务:普通成员
等级:1
金币:0.0
发贴:88
|
#52001/6/7 11:31:37
hi: You could write like this(sorry, my Chinese input tool doesn't work): >> write the following into parent named “xx”: on mouseUp set the visible of sprite 1 to FLASE end >> write the following into other(not sprite 1) sprite's behavior: on mouseUp me mouseUp new(scipt"xx") end
============================ Another way to resolve. Something complex, with 1 simple behavior for all sprites and special parent for each other: >> make a behavior, and drop it to the sprites that you want to receive the mouse event. Script likes following(just 2 lines, nothing more): on mouseUp end
>> Write script in parent named "main" ( 'the clickOn' and 'theSprite' pass the event of sprite to the script): set the mouseDownScript to "mMouseDown gGlobal, the clickOn" on mMouseDown me, theSprite -- some case you want mMouseDown new(script"children" , theSprite) -- some case you want end
>> Write script into parent "children" on mMouseDown me -- whatever you want end
>> You can use "repeat while the stillDown" and"if rollover(pSprite)"... to make mouseUp, stillDown and something like this by yourself.
>> And, I call "gGlobal" in the initialize script(Behavior on frame)
That's all Thanks for reading!
|
 zain
职务:普通成员
等级:1
金币:0.0
发贴:88
|
#62001/6/7 11:40:03
these words were founded in HELP of director 8.5: "When the user clicks the Stage, clickOn returns 0. To detect whether the user clicks a sprite with no script, you must assign a placeholder script to it ("--," for example) so that it can be detected by the clickOn function. "
raise or rest in peace Good luck
|