In Flash, the ActionScript would look as follows:
getURL("event:alertMessageReceived");
When Director receives the getURL message from the Flash sprite, the Director movie
immediately executes the script statement.
Sending script statements with arguments
It is possible to send script statements that are more complicated than a string or statements that
call a single script handler reference. Sending handlers with arguments or sending arguments that
contain double quote characters takes more effort to make sure that the script statement is
properly formed.
Note: To send simple strings and statements, see
on page
190.
Suppose you have a Director handler in a movie script that adds two numbers and presents an
alert with the sum, as follows:
on addTwoNumbers number1, number2
myResult = number1 + number2
_player.alert(string(myResult))
end
To pass arguments to this script (
statement in your Flash ActionScript:
getURL("lingo:addTwoNumbers 100, 200");
If the arguments are strings, you need to escape the double quote characters using a backslash
character on each double quote character that you want to be passed through to Director. For
example, if you want to send a script statement from the Flash sprite which tells Director to
launch a browser and open macromedia.com, you would do the following:
getURL("lingo:gotonetpage(\"http://www.macromedia.com\")");
It may be easier to fabricate the script statement in a temporary variable inside the Flash method
and then use getURL on that variable as follows:
var theString = getURL("lingo:gotonetpage(\"http://www.macromedia.com\")");
getURL(theString);
Additionally, you may want to send the value of a Flash variable as part of the script statement.
For example, if
myFlashVar
(
myFlashVar="director"
Flash script:
var theString = getUrl("lingo:gotonetpage(\"http://www.macromedia.com/
software/" + myFlashVar + "\")");
getURL(theString);
The resulting URL would be "http://www.macromedia.com/software/director" and would be
passed to the browser through Director's
192
Chapter 9: Using Flash, Flash Components, and Other Interactive Media Types
"Sending simple messages and script statements"
and
number1
number2
in Flash represents a Macromedia product such as Director
in ActionScript), you could form a script statement as follows in your
goToNetPage
), you would include the following
command.
Need help?
Do you have a question about the DIRECTOR MX 2004-USING DIRECTOR and is the answer not in the manual?
Questions and answers