In an HTML or text editor, open the HTML file that was generated in step 6 and examine the
7.
code. When you published your SWF file using the Flash with FSCommand template on the
HTML tab of the Publish Settings dialog box, some additional code was inserted in the HTML
file. The SWF file's
myMovie.fla, the attributes would be set to
In the HTML file, add the following JavaScript code where the document says
8.
:
code here.
if (command == "alert") {
alert(args);
}
else if (command == "popup") {
window.open(args, "mmwin", "width=500,height=300");
}
Alternatively, for Microsoft Internet Explorer applications, you can attach an event handler
directly in the
<Script Language = "JavaScript" event="FSCommand (command, args)" for=
"theMovie">
...
</Script>
Save and close the HTML file.
9.
When you're editing HTML files outside of Flash in this way, remember that you must
deselect the HTML check box in File > Publish Settings, or your HTML code will be
overwritten by Flash when you republish.
In a web browser, open the HTML file to view it. Click the Open Window button; a window
10.
opens to the Macromedia website. Click the Alert button; an alert window opens.
The
fscommand()
Lingo as strings, events, or executable Lingo code. If the message is a string or an event, you must
write the Lingo code to receive it from the
Director. For more information, see the Director Support Center at
support/director.
In Visual Basic, Visual C++, and other programs that can host ActiveX controls,
sends a VB event with two strings that can be handled in the environment's programming
language. For more information, use the keywords Flash method to search the Flash Support
Center at www.macromedia.com/support/flash.
About Flash Player methods
You can use Flash Player methods to control a SWF file in Flash Player from web-browser
scripting languages such as JavaScript and VBScript. As with other methods, you can use Flash
Player methods to send calls to SWF files from a scripting environment other than ActionScript.
Each method has a name, and most methods take parameters. A parameter specifies a value upon
which the method operates. The calculation performed by some methods returns a value that can
be used by the scripting environment.
and
attributes are the filename. For example, for the file
NAME
ID
tag, as shown in this example:
<SCRIPT>
function can send messages to Macromedia Director that are interpreted by
.
myMovie
function and carry out an action in
fscommand()
Sending messages to and from Flash Player
// Place your
www.macromedia.com/
fscommand()
287
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers