Accessibility

TechNote (Archived)

Setting the browser status bar from a Flash movie

This TechNote explains how to set the browser status bar message from a Flash movie.

To see an example of a status bar message, roll your mouse over these words and view the browser status bar at the bottom of the browser window (you should see ''This is the status bar!' displayed there). This is accomplished by calling a JavaScript function when the pointer rolls over the link.

In order to accomplish this from a button within a Flash movie, we useFSCommand. This TechNote explains how to set up anFSCommandand create the required JavaScript to set the status bar from a Flash movie.

Note:FSCommand does not work with all browsers on all platforms. Refer to Flash Player browser support matrix (TechNote 14159) for a complete list of which browsers and platforms support FSCommand and other scripting methods. Also, on most Web browsers, the status bar can be turned off by changing browser preferences.

Setting up the FSCommand in Flash
The following steps explain how to set up a button in Flash to send anFSCommandto the browser. It also shows how to use the Publish feature to create an HTML file that contains the basic JavaScript framework for working withFSCommand.

Steps to set up the Flash movie:

1

In a new movie, attach the following FSCommand actions to a button instance:

 on (rollOver) {
		
fscommand("setStatus", "Rolling over..."):
}
on (rollOut) {
fscommand("setStatus", "Rolling out...");
}
2

Save the file asstatus.fla.

Note:Any file name is fine as long as it does not contain any spaces or special characters.

3

Open the Publish Settings dialog (File > Publish Settings), and click the HTML tab.

4 Choose 'Flash with FSCommand' from the Template pop-up menu.
5

Click OK.

6

Publish the SWF and the HTML file by pressing Shift + F12 or by choosing File > Publish.

After publishing there will be two files in the current working directory:status.swfandstatus.html.

Adding the JavaScript code to the published HTML page
The HTML page published by Flash (status.html) contains, among other things, a JavaScript function that looks like this:

 function status_DoFSCommand(command, args) {   var statusObj = InternetExplorer ? status : document.status;   //   // Place your code here...   // } 

All that is necessary is to insert the appropriate JavaScript code that checks for the FSCommand and then sets the browser's status bar.

Steps to modify the published HTML document:

1

Openstatus.htmlin an HTML editor or text editor. Locate the lines within the HTML file that reads:

 //
		
// Place your code here...
//
2

Replace those lines with the following:

 if (command=="setStatus") {    window.status = args; } 

The variable namedcommandcorresponds to the first argument supplied to theFSCommandaction in Flash ("setStatus"), andargscorresponds to the second argument ("Rolling over...", or, "Rolling out...").

The JavaScript code first checks if the command is "setStatus" and, if so, sets the status bar message to the second argument.

3

Save and preview the file in a supported Web browser.

Additional information
The Status Bar Message Extension, available for download from theMacromedia Exchange for Flash, provides a Flash movie with the same functionality discussed above. For more information on using FSCommand and scripting with Flash in general, see Scripting with Flash.



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_14827

Products Affected:

flash