Adobe 65036570 - Director - PC User Manual page 218

User guide
Hide thumbs Also See for 65036570 - Director - PC:
Table of Contents

Advertisement

Set up the
callback. An
1
onStatus
connection object and contains information about the success or failure of the send operation.
sprite(name).setCallback(pLocalConn, "onStatus", #myOnStatus, me)
This script statement sets a callback for the event named
script handler name is
this
method, referred to as
setCallback()
preceding the handler name. The pound sign converts the handler name to a symbol.
For information on the actual callback handlers, such as the
2
Set up the
allowDomain
receives an incoming message.
sprite(name).setCallback(pLocalConn, "allowDomain", #myAllowDomain, me)
In this case, the event name is
If the
myAllowDomain
with the message subject is generated. When a movie is running from a user's computer and not in a browser,
the domain is
localHost
hosts the movie, such as adobe.com.
Set up the callback for these user-defined messages. Decide what string you want to use as your message subjects,
3
so that you know what the event name will be. In the following example, the user-defined message subject and event
name are
incomingMessage
sprite(name).setCallback(pLocalConn, "incomingMessage", #myIncomingMessage, me)
Writing callback handlers
For callbacks to work, you must write the callback handlers themselves. In this example, the
methods are all inside a
beginSprite
because they are handlers by themselves. In this example, the callback handlers are located in the same script
attached to the Flash sprite, just after the
The
event is generated each time the local connection object sends an outgoing message. The
onStatus
handler might look like the following:
on myOnStatus (me, aInfoObject)
if (aInfoObject[#level] = "error") then
member("chat input").text = "Error sending last message."
else
member("chat output").text = member("chat output").text & RETURN & member("chat
input").text
end if
end myOnStatus
Two arguments are passed with the
that the event was generated on the same script object that contains the
argument contains a Flash array object containing information about the status of the message-sending operation.
The handler checks to see if the
error message is displayed in a chat input field. If no error occurs, a text output field is updated with the contents of
the chat input field. For more information about the Flash
event is generated each time a message is sent by the local
onStatus
and the script object that contains it is the same script object that contains
myOnStatus
. The quotes surroundthe event name and the pound sign (#)
me
callback. An
allowDomain
and the handler name is
AllowDomain
handler determines that the message is coming from an allowed domain, an event named
. When the movie is running in a browser, the domain is determined by the server that
:
handler. The callback handlers must be outside the
beginSprite
event by the local connection object. The
onStatus
argument contains an error. In this example, if there is an error, an
aInfoObject
generated by the object
onStatus
handler, see
myOnStatus
event is generated each time the local connection object
myAllowDomain
handler.
myOnStatus
, see the Flash Media Server documentation.
infoObject
ADOBE DIRECTOR 11.0
User Guide
. The
pLocalConn
Writing callback
handlers.
.
setCallback()
handler
beginSprite
myOnStatus
argument tells the script
me
handler. The
aInfoObject
207

Advertisement

Table of Contents
loading

This manual is also suitable for:

Director 11

Table of Contents