Hi, I made sample scripts to refer correct ME which is set as a property of the parent script. The event manager let you select an event of the sprite behavior as the ancestor. It sends a message to the behavior instance on the event. _____ James Newton wrote: > In other words: > * a child instance can access its ancestor's handlers and properties > as well as its own. While handlers in the ancestor script are > executing, the <me> value is that of the child instance. > * the ancestor instance has no knowledge of its children if it is > called directly. > * if a handler in an ancestor is triggered because no such handler > appears in the child, then the ancestor handler can access properties > and handlers in its child, so long as they are identified by "me." > (e.g: me.spriteNum) Regards, Fumio Nonaka Attain Corporation [EMAIL PROTECTED] ----------------------------- -- EventManager -- Parent Script for Ancestor ----------------------------- property pMyOrigin on new me, origin if ilk(origin) = #instance then pMyOrigin = origin else pMyOrigin = me end if return me end on mouseUp me put #up if me.pMyOrigin.psEvent = #mouseUp then me.pMyOrigin.xEventCall() end on mouseDown me if me.pMyOrigin.psEvent = #mouseDown then me.pMyOrigin.xEventCall() end on exitFrame me if me.pMyOrigin.psEvent = #exitFrame then me.pMyOrigin.xEventCall() end on xEventCall me call(me.pMyOrigin.psMessage, me.pMyOrigin) end on getPropertyDescriptionList me lProp = [:] lDesc = [:] lProp[#psEvent] = lDesc lDesc[#comment] = "Which event:" lDesc[#format] = #symbol lDesc[#range] = [#mouseUp, #mouseDown, #exitFrame] lDesc[#default] = #mouseUp lDesc = [:] lProp[#psMessage] = lDesc lDesc[#comment] = "Message to call:" lDesc[#format] = #symbol lDesc[#default] = #xDoAction return lProp end ----------------------------- -- SpriteBehavior ----------------------------- property ancestor on beginSprite me, origin ancestor = script("EventManager").new(me) end on xDoAction me alert string([#spite: me.pMyOrigin.spriteNum, #message: me.pMyOrigin.psAlert]) end on getPropertyDescriptionList me lProp = script("EventManager").getPropertyDescriptionList() lDesc = [:] lProp[#psAlert] = lDesc lDesc[#comment] = "Alert message:" lDesc[#format] = #string lDesc[#default] = "I'm called!" return lProp end [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to