
Sending messages from Flash content using getURL
191
To handle a message string passed by Flash content:
1
Specify the message string in the Flash content, as described above.
For example, in Flash, you could specify the following string as the URL parameter of the
getURL
function:
Hello World
In Flash, the ActionScript would look like this:
getURL("Hello World");
2
In Director, include an
on getURL
handler to receive and read the string passed by the
Flash content.
For example, in Director, you could enter the following handler in a movie script:
on getURL me, stringFromFlash
_movie.go("stringFromFlash")
end
When the
on getURL
handler receives the text string ("Hello World"), it reads the string and
then jumps to the frame labeled Hello World in the Director Score.
To set up a script statement for execution at the Movie level:
1
In Flash, specify an event message by specifying the word lingo followed by a colon, the name
of a handler you write in Director, and a parameter (if any) to pass with the event.
For example, in Flash, you could specify the following statement as the URL parameter of the
getURL function:
lingo: myDirectorScript
In Flash, the ActionScript would look as follows:
getURL("lingo:myDirectorScript");
Note:
Using lingo: with getURL fully supports sending Lingo, not JavaScript, syntax. However,
you can send JavaScript syntax method calls to Director since the syntax for calling a method is
the same syntax as calling Lingo handlers.
2
In Director, include an event handler to execute the statement passed by the Flash content.
For example, in Director, you could write a corresponding handler as follows:
on myDirectorScript
_movie.go("Flash Message Received")
end
When the Director script receives the myDirectorScript message, the movie executes the
movie-level Director script handler and jumps to the frame specified in the handler.
To set up a script statement for execution at the sprite/Behavior level:
•
In Flash, specify a script statement to be sent to a behavior attached to the Flash sprite from
which the script message is sent.
You specify the statement by specifying the word event, followed by a colon, followed by the
script statement that you want the behavior to execute.
For example, in Flash, you could specify the following statement as the URL parameter of the
getURL function:
event: alertMessageReceived
Summary of Contents for DIRECTOR MX 2004-USING DIRECTOR
Page 1: ...DIRECTOR MX 2004 Using Director...
Page 16: ...16 Chapter 1 Introduction...
Page 82: ...82 Chapter 3 Sprites...
Page 98: ...98 Chapter 4 Animation...
Page 134: ...134 Chapter 5 Bitmaps...
Page 242: ...242 Chapter 10 Sound and Synchronization...
Page 274: ...274 Chapter 11 Using Digital Video...
Page 290: ...290 Chapter 12 Behaviors...
Page 302: ...302 Chapter 13 Navigation and User Interaction...
Page 334: ...334 Chapter 15 The 3D Cast Member 3D Text and 3D Behaviors...
Page 392: ...392 Chapter 16 Working with Models and Model Resources...
Page 418: ...418 Chapter 18 Movies in a Window...
Page 446: ...446 Chapter 22 Managing and Testing Director Projects...