Set the browser status bar from SWF file | FlashProducts affected
This TechNote explains how to set the browser status bar message from a SWF file using ActionScript 2.0.
To see an example of a status bar message, roll your mouse over these words. View the browser status bar at the bottom of the browser window (''This is the status bar!' appears). This effect is accomplished by calling a JavaScript function when the pointer rolls over the link.
In order to accomplish this effect from a button within a SWF file, use FSCommand. This TechNote explains how to set up anFSCommand and create the required JavaScript to set the status bar from a SWF file.
Note: FSCommand doesn't work with all browsers on all platforms. See Flash Player browser support matrix 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.
Set 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.
- 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...");
}

- Save the file as
status.fla.
Note: Any filename is fine as long as it does not contain any spaces or special characters. - Open the Publish Settings dialog (File > Publish Settings), and click the HTML tab.
- Choose 'Flash with FSCommand' from the Template pop-up menu.

- Click OK.
- Publish the SWF file and the HTML file by pressing Shift + F12 or by choosing File > Publish. After publishing there are two files in the current working directory:
status.swfandstatus.html.
Add 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 the following:
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.
pen
status.htmlin an HTML editor or text editor. Locate the lines within the HTML file that reads://
// Place your code here...
//
- 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. - Save and preview the file in a supported Web browser.
Additional information
The Status Bar Message Extension, available for download from the Exchange for Flash, provides a SWF file with the same functionality discussed above. For more information on using FSCommand and scripting with Flash in general, see ActionScript 2.0 and Components Help.
Doc ID
(tn_14827)
Last updated
2011-05-31
Products affected
