FSCommand

The other way to call a JavaScript command from Flash is the FSCommand. The FSCommand in Flash 5 is an interesting thing. It can be used to access a specific JavaScript function, or it can be used to control the standalone Flash Player. Note FSCommand doesn't work in Netscape 6 (which is why I don't use FSCommand), but future versions of Flash should fix this.

Let's look at the way to access JavaScript via fscommand. It's not the way I recommend accessing JavaScript from Flash—getURL is easier. We'll go over it just so you know.

Let's say you wanted to mimic the JavaScript function showAlert. Here's the code you'd use.

on(release)
{
    fscommand("alert",_root.userMessage);
}

If you're using Flash, you need to publish the page differently ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.