Accessibility

TechNote

Using JavaScript with Flash Player

Flash Player 6 (6.0.40.0) and later versions support certain JavaScript methods that are specific to Flash applications, as well as fscommand(), in Netscape 6.2 and later. Earlier versions do not support these JavaScript methods and fscommand() in Netscape 6.2 or later.

For Netscape 6.2 and later, you do not need to set the swliveconnect attribute to true. However, settingswLiveConnect to true has no adverse effects on your SWF file.

The following sites are the best starting point for troubleshooting JavaScript, VBScript and JScript problems:

Getting Started

You can use Flash Player methods to control a SWF file in Flash Player from web-browser scripting languages such as JavaScript and VBScript. As with other methods, you can use Flash Player methods to send calls to SWF files from a scripting environment other than ActionScript. Each method has a name, and most methods take parameters. A parameter specifies a value upon which the method operates. The calculation performed by some methods returns a value that can be used by the scripting environment.

Two technologies enable communication between the browser and Flash Player: LiveConnect (Netscape Navigator 3.0 or later on Windows 95/98/2000/NT/XP or Power Macintosh) and ActiveX (Internet Explorer 3.0 and later on Windows 95/98/2000/NT/XP). Although the techniques for scripting are similar for all browsers and languages, there are additional properties and events available for use with ActiveX controls.

The fscommand()function lets a SWF file communicate with a script in a web page. However, script access is controlled by the web page's setting. (You set this attribute in the HTML code that embeds the SWF file--for example, in the tag for Internet Explorer or the tag for Netscape. When allowScriptAccess is set to "never", a SWF file cannot access web page scripts. With Flash Player 7 and later, when allowScriptAccess is set to "always", a SWF file can always access web page scripts. When allowScriptAccess is set to "sameDomain", scripting is allowed only from SWF files that are in the same domain as the web page; scripting is always allowed with previous versions of Flash Player. If allowScriptAccess is not specified in an HTML page, the attribute is set by default to "sameDomain" for SWF files of version 8 and later, and to "always" for SWF files of version 7 and earlier.

To use fscommand() to open a message box from a SWF file in the HTML page through JavaScript

Additional Information


About the External API :

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001599.html

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_04160

Products Affected:

flash