•
To access a property of the object, such as the array's length, you only need to refer to the
property as a property of the object reference you created:
put myNewFlashObject.length
-- 3
•
To access a part of the object, such as the value of the third item in the array, use the following
syntax:
put myNewFlashObject[2]
-- "banana"
Note: The items in an ActionScript array are numbered beginning with zero, while the items in a Lingo list are
numbered beginning with one. Be sure to use the correct number when referring to items in arrays or lists.
•
To access a method of the object, use the same syntax and specify the method name after the
object reference:
myNewFlashObject.sort()
For more information about the types of objects supported by Flash and the methods and
properties used to control them, see the Flash documentation.
Setting callbacks for Flash objects
Some kinds of Flash objects generate events that need to be routed to an appropriate Lingo
handler. For example, a Flash Communication Server connection object generates an event each
time an incoming message is received from the server. You can tell Lingo to route events like this
to a specific handler in a specific Lingo script object by using the
•
To set up a callback for an event from a Flash object, use Lingo similar to this:
myConnection = sprite(1).newObject("NetConnection")
sprite(1).setCallback(myConnection, "onStatus", #dirOnStatusHandler, me)
In the first line of this example, a new
it named
myConnection
dirOnStatusHandler
argument
indicates that the handler is located in the same script object that the
me
command is being issued in. In this case that script object is attached to sprite 1.
setCallback()
The callback handler could look like the following:
on dirOnStatusHandler (me, aInfoObject)
if (aInfoObject[#level] = "error") then
member("chat input").text = "Error sending last message."
end if
end
netConnection
. The second line tells Lingo to call the handler named
whenever the
myConnection
setCallback()
object is created along with a reference to
object generates an
Using Flash and Other Interactive Media Types 305
command.
event. The
onStatus
Need help?
Do you have a question about the DIRECTOR MX-USING DIRECTOR MX and is the answer not in the manual?
Questions and answers