There are two basic actions that can be performed with Flash scripting.
- Control Shockwave Flash using a method such as Play(), or CurrentFrame().
There are 1- methods made available to you by the Shockwave Flash player.
These methods are not available until after the plugin is loaded by the browser. If you try to control a plugin with any of these methods before it is loaded, error messages will be displayed. This is because the script is attempting to use a method that is available from the plugin, but no instance of the plugin exists. To avoid this problem, have your Flash movie send an FSCommand event using the Get URL action applied to frame 1 in the movie. When the plugin and the movie load, the event will be passed to your script and you may then make a function call to execute a method.
- Play() - Start playing the animation.
- StopPlay() - Stop playing the animation.
- IsPlaying() - Returns true if the movie is currently playing.
- GotoFrame (int frameNum) - Goto a specific frame of the movie.
- TotalFrames() - Returns the total number of frames in the movie.
- Rewind() - Go back to the first frame.
- SetZoomRect (int left, int top, int right, int bottom) - Zoom in on a rectangular area of the movie. Note that the units of the coordinates are in twips (1440 units per inch).
- Zoom(int percent) - Zoom the view by a relative scale factor. Zoom(50) will double the size of the objects in the view. Zoom(200) will reduce the size of objects in the view by one half. Zoom(0) resets the view to 100%.
- Pan (int x, int y, int mode) - Pan a zoomed in movie. The mode can
- 0 = pixels
- 1 = % of window.
- PercentLoaded() - Returns the percent of the SwF file that has streamed in to the browser so far ranges (0-100).
To call methods in a Shockwave Flash movie, your EMBED and OBJECT tags must include a NAME/ID. Also, the "#version=2,0,0,11" ensures that the proper version of the ActiveX control is installed
This code snippet accesses the loaded Shockwave Flash and rewinds the movie to the beginning and them resets any zoom settings back to normal. Notice the casual but powerful browser detect in the script.
More info at: http://www.macromedia.com/support/flash/