Use the fscommand action to send a message to whichever program is hosting the Flash Player. The fscommand action has two parameters: command and arguments. To send a message to the stand-alone version of the Flash Player, you must use predefined commands and arguments. For example, the following action sets the stand-alone player to scale the movie to the full monitor screen size when the button is released:
To use fscommand to send a message to a scripting language such as JavaScript in a Web browser, you can pass any two arguments in the command and arguments parameters. These arguments can be strings or expressions and will be used in a JavaScript function that "catches," or handles, the fscommand action.
on(release){The following table shows the values you can specify for the command and arguments parameters of the fscommand action to control a movie playing in the stand-alone player (including projectors):
fscommand("fullscreen", "true");
}
Command | Arguments | Purpose |
---|---|---|
quit | None | Closes the projector. |
fullscreen | true or false | Specifying true sets the Flash Player to full-screen mode. Specifying false returns the player to normal menu view. |
allowscale | true or false | Specifying false sets the player so that the movie is always drawn at its original size and never scaled. Specifying true forces the movie to scale to 100% of the player. |
showmenu | true or false | Specifying true enables the full set of context menu items. Specifying false dims all the context menu items except About Flash Player. |
exec | Path to application | Executes an application from within the projector. |
To use fscommand to send a message to a scripting language such as JavaScript in a Web browser, you can pass any two arguments in the command and arguments parameters. These arguments can be strings or expressions and will be used in a JavaScript function that "catches," or handles, the fscommand action.
An fscommand action invokes the JavaScript function moviename_DoFSCommand in the HTML page that embeds the Flash movie, where moviename is the name of the Flash Player as assigned by the NAME attribute of the EMBED tag or the ID attribute of the OBJECT tag. If the Flash Player is assigned the name my Movie, the JavaScript function in voked is my Movie_DoFSCommand.
To use the fscommand action to open a message box from a Flash movie in the HTML page through JavaScript:
To use the fscommand action to open a message box from a Flash movie in the HTML page through JavaScript:
1 | In the HTML page that embeds the Flash movie, add the following JavaScript code: |
function theMovie_DoFSCommand(command, args) { alert(args); | |
If you publish your movie using the Flash with FSCommand template in the HTML Publish Settings, this code is inserted automatically. The movie's NAME and ID attributes will be the file name. For example, for the file myMovie.fla, the attributes would be set to myMovie. For more information about publishing, see Flash Help. | |
2 | In the Flash movie, add the fscommand action to a button: |
fscommand("messagebox", "This is a message box invoked from within Flash.") | |
You can also use expressions for the fscommand action and arguments, as in the following example: | |
fscommand("messagebox", "Hello, " & name & ", welcome to our Web site!") | |
3 | Choose File > Publish Preview > HTML to test the movie. |
![]() |
The fscommand action can send messages to Macromedia Director that are interpreted by 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 fscommand action and carry out an action in Director. For more information, see the Director Support Center.
In Visual Basic, Visual C++, and other programs that can host ActiveX controls, fscommand 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 Support Center.
0 comments:
Post a Comment