The AF FS Command JavaScript Library is now available
This library enables the standard methods of interaction with Flash movies via JavaScript. In addition, this library includes functions for creating popup windows, getting the time and date, and more. All functions in the library may be called via FS Command or Get URL from within Flash movies or from JavaScript within the HTML page. Methods for communication with multiple movies in the same document or across frames and windows are also available.

See the AF FS Command JavaScript Library page

Talk to Yourself

This is a pseudo chat client that demonstrates communicating between two swf files in separate frames or windows. You simply input text into the text box on one chat box and hit the 'send' button to transfer the text to the other chat box.

These examples are intended for people with some experience with JavaScript who would like to enable FS Command methods across frames and windows without use of the AF FS Command JavaScript Library.

In all of the examples available from the bottom of this page, the movie name in the embed and object tags is 'fscom'. The text box inside the fscom swf movie is labeled 'chatbox'. The FSCommand is set to FS Command ("send", /:chatbox) from the release mouse event of the send button.

The f1 variable in each script is either preset in the html or set by a script function. The f1 variable sets the location (frame or window) for the opposite instance of the 'talk to yourself' flash file (the one you are sending the information to). The 'fscom1' variable sets the object reference for the swf.

The script is not commented at this time. In general, it works like this:
1) A page with a swf is loaded.
2) The onLoad event in the body tag is used to call a function that sets fscom1 (the object reference).
(Note: fscom1 must also be global to the page so that it can be found by other pages. This is done by initially placing it outside of any function and declaring it as having a null value.)
3)The f1 location reference is either already set or is set by the opening document.

So, to set the variables in a swf in another page, you need to refer to it as f1.fscom1.setVariable("varName", "value"). Which translates as Window and Frame Reference.Embedded Object Reference.Set Variable Function

Feel free to view the source and use it as you please. I worked with the automatically generated Flash4 page (from the template for including FSCommands) so that you can easily compare it to an original and see what was added and changed.

I hope this helps.
(And, that you have fun talking to yourself.)


Talk to Yourself Examples

Communicate between 2 frames
Communicate between main browser and a new window (pop up)
Communicate between 2 new windows (2 popups)
(Note on 2 popup version: look at the source of the loading window as well as this sets the f1 values.)