Example
Usage 1: In the following example, the
file to the full monitor screen size when the button is released.
on(release){
fscommand("fullscreen", true);
}
Usage 2: The following example uses the
JavaScript message box in an HTML page. The message itself is sent to JavaScript as the
parameter.
fscommand
You must add a function to the HTML page that contains the SWF file. This function,
myDocument_DoFSCommand
When an
fscommand
and
command
parameter
use the passed strings in your JavaScript or VBScript code in any way you like. In this example,
the function contains a conditional
. If it is, a JavaScript alert box (or "message box") opens and displays the contents
"messagebox"
of the
parameters
function myDocument_DoFSCommand(command, args) {
if (command == "messagebox") {
alert(args);
}
}
In the Flash document, add the
fscommand("messagebox", "This is a message box called from within Flash.")
You can also use expressions for the
example:
fscommand("messagebox", "Hello, " + name + ", welcome to our website!")
To test the movie, choose File > Publish Preview > HTML.
Note: If you publish your SWF file using the Flash with FSCommand template in the HTML Publish
Settings, the
myDocument_DoFSCommand
attributes will be the filename. For example, for the file myDocument.fla, the attributes would be set to
.
myDocument
fscommand
fscommand
sits in the HTML page and waits for an
is triggered in Flash (for example, when a user presses the button), the
strings are passed to the
statement that checks to see if the command string is
if
string.
fscommand
fscommand
function is inserted automatically. The SWF
action sets the Flash Player to scale the SWF
action applied to a button in Flash to open a
myDocument_DoFSCommand
action to a button:
action and parameters, as in the following
action in Flash.
fscommand
function. You can
file
's
and
NAME
fscommand()
ID
387
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?