591
When the handler runs, the Message window displays the following:
[12, 34, 6, 10, 45]
See also
[ ] (bracket access)
setCallback()
Syntax
flashSpriteReference
.setCallback(
actionScriptObject
,
ASEventName
,
#LingoHandlerName
,
lingoScriptObject
)
setCallback(
actionScriptObject
,
ASEventName
,
#LingoHandlerName
,
lingoScriptObject
)
Description
Flash command; this command can be used as a sprite or a global method to define a Lingo
callback handler for a particular event generated by the specified object. When ActionScript
triggers the event in the object, that event is redirected to the given Lingo handler, including all
arguments that are passed with the event.
If the ActionScript object was originally created within a Flash sprite, use the
flashSpriteReference
syntax. If the object was originally created globally, use the global syntax.
Note:
If you have not imported any Flash cast members, you must manually add the Flash Asset Xtra to your movie’s
Xtra list in order for global Flash commands to work correctly. You add Xtra extensions to the Xtra list by choosing
Modify > Movie > Xtras.For more information, see Managing Xtra extensions for distributed movies in Using Director.
Examples
This statement sets a the Lingo handler named
myOnStatus
in the Lingo script object
me
to be
called when an
onStatus
event is generated by the ActionScript object
tLocalConObject
in the Flash
movie in sprite 3:
sprite(3).setCallback(tLocalConObject, "onStatus", #myOnStatus, me)
This statement sets the Lingo handler named
myOnStatus
in the Lingo script object
me
to be called
when an
onStatus
event is generated by the global ActionScript object
tLocalConObject
:
setCallback(tLocalConObject, "onStatus", #myOnStatus, me)
The following statements create a new global XML object and create a callback handler that
parses XML data when it arrives. The third line loads an XML file. The callback handler is
included as well.
gXMLCB = newObject("XML")
setCallback( gXMLCB, "onData", #dataFound, 0 )
gXMLCB.load( "myfile.xml" )
-- Callback handler invoked when xml data arrives
on dataFound me, obj, source
obj.parseXML(source)
obj.loaded = 1
obj.onload(TRUE)
end dataFound
See also
newObject()
,
clearAsObjects()
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...