Class com.macromedia.flash.FlashApi

java.lang.Object
   |
   +----com.macromedia.flash.FlashApi

public class FlashApi
extends Object
A FlashApi is an object which interfaces with the context of a "Flash" player whose class is Flash.class. If used in an an application one way to start the player and to control it exemplified below

flashPlayer = new FlashApi(new Flash());
flashPlayer.SetComponent(this);
flashPlayer.LoadScript(new FileInputStream("FlashMovie.swf"));
flashPlayer.Startup();

The end user can create as many players as she wishes by instantiating the player using the example above.


Variable Index

 o PAN_PERCENT
Pan mode
 o PAN_PIXELS
Pan mode
 o QUALITY_AUTOHIGH
Rendering Quality of the "Flash" movie
 o QUALITY_AUTOLOW
Rendering Quality of the "Flash" movie
 o QUALITY_BEST
Rendering Quality of the "Flash" movie
 o QUALITY_HIGH
Rendering Quality of the "Flash" movie
 o QUALITY_LOW
Rendering Quality of the "Flash" movie

Constructor Index

 o FlashApi(Flash)
Construct the api object

Method Index

 o Back()
Steps one frame back
 o CurrentFrame()
Returns the current frame of the "Flash" movie
 o FlashVersion()
Return Ver major in the high 16 bits and ver minor in the low 16 bits
 o Forward()
Setps one frame forward
 o FrameLoaded(int)
Returns true if frame is loaded
 o GetBgColor()
Get the background color of the "Flash" movie
 o GetBounds()
Returns the bounds of the "Flash" rendering area
 o GetComponent()
Returns the component flash renders into
 o GetTranslate()
Gets the offset of the starting point where the "FLash" movie is drawn in the component
 o GotoFrame(int)
Goto a specific frame in the "Flash" movie
 o HandleEvent(Event)
Update event causes "FLash" to redraw itself.
 o IsPlaying()
Returns true if the animation thread is not paused
 o LoadScript(InputStream)
Load "Flash" movie script using the stream which point to the script itself.
 o Paint(Graphics)
Paint event causes "FLash" to redraw itself.
 o Pan(int, int, int)
Set the number of pixels to pan in the x, y derection
 o PercentLoaded()
returns a number between 1 and 100
 o Play()
Tells the animation thread to animate
 o Rewind()
Rewind the movie to frame 0
 o SetBgColor(int)
set the background color of the "Flash" movie.
 o SetComponent(Component)
Assign a component for Flash render into
 o SetLoop(boolean)
Set the movie looping state.
 o SetQuality(int, boolean)
set rendering quality and forceRedraw if needed.
 o SetSoundMute(boolean)
Mute the sound if flag is true else unmute it
 o SetTranslate(int, int)
Sets the offset of the starting point where to draw the "Flash" movie in the component
 o SetZoomRect(int, int, int, int)
Zoom in on a rectangular area of the movie.
 o Shutdown()
Destroys the animation thread
 o Startup()
creates the animation thread only used if the applet start() is not used
 o StopPlay()
Tells the animation thread to pause the animation
 o StopSound()
Turn of all currently playing sound
 o TotalFrames()
Returns the number of frames in a flash movie
 o Update(Graphics)
Update event causes "FLash" to redraw itself.
 o Zoom(int)
zomm into x and y direction by percent (ex: in order to double you must pass in 50.

Variables

 o QUALITY_LOW
 public static final int QUALITY_LOW
Rendering Quality of the "Flash" movie

See Also:
SetQuality
 o QUALITY_AUTOLOW
 public static final int QUALITY_AUTOLOW
Rendering Quality of the "Flash" movie

See Also:
SetQuality
 o QUALITY_AUTOHIGH
 public static final int QUALITY_AUTOHIGH
Rendering Quality of the "Flash" movie

See Also:
SetQuality
 o QUALITY_HIGH
 public static final int QUALITY_HIGH
Rendering Quality of the "Flash" movie

See Also:
SetQuality
 o QUALITY_BEST
 public static final int QUALITY_BEST
Rendering Quality of the "Flash" movie

See Also:
SetQuality
 o PAN_PIXELS
 public static final int PAN_PIXELS
Pan mode

See Also:
Pan
 o PAN_PERCENT
 public static final int PAN_PERCENT
Pan mode

See Also:
Pan

Constructors

 o FlashApi
 public FlashApi(Flash flash)
Construct the api object

Parameters:
flash - The context we are interfacing with

Methods

 o GotoFrame
 public synchronized void GotoFrame(int frame)
Goto a specific frame in the "Flash" movie

 o Rewind
 public void Rewind()
Rewind the movie to frame 0

 o Back
 public void Back()
Steps one frame back

 o Forward
 public void Forward()
Setps one frame forward

 o IsPlaying
 public boolean IsPlaying()
Returns true if the animation thread is not paused

 o Play
 public void Play()
Tells the animation thread to animate

 o FlashVersion
 public int FlashVersion()
Return Ver major in the high 16 bits and ver minor in the low 16 bits

 o CurrentFrame
 public int CurrentFrame()
Returns the current frame of the "Flash" movie

 o TotalFrames
 public int TotalFrames()
Returns the number of frames in a flash movie

 o FrameLoaded
 public boolean FrameLoaded(int frame)
Returns true if frame is loaded

 o PercentLoaded
 public int PercentLoaded()
returns a number between 1 and 100

 o StopPlay
 public void StopPlay()
Tells the animation thread to pause the animation

 o Pan
 public void Pan(int x,
                 int y,
                 int panMode)
Set the number of pixels to pan in the x, y derection

See Also:
PAN_PIXELS, PAN_PERCENT
 o Zoom
 public void Zoom(int percent)
zomm into x and y direction by percent (ex: in order to double you must pass in 50. In order to double again you must pass 50 again). If you pass in zero we go back to original size with translate set to zero. Note: currently this method anchors at UL corner. Eventually we want to anchor at an arbitrary point.

 o SetZoomRect
 public void 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). To calculate a rectangle in Macromedia "Flash", set the ruler units to Points and multiply the coordinates by 20 to get TWIPS.

 o Startup
 public synchronized void Startup()
creates the animation thread only used if the applet start() is not used

 o Shutdown
 public void Shutdown()
Destroys the animation thread

 o LoadScript
 public void LoadScript(InputStream is)
Load "Flash" movie script using the stream which point to the script itself. This function automatically classes the stream once its done with it note: Loading spawns a different thread from the animation thread, and once loading is done the thread dies.

 o SetComponent
 public void SetComponent(Component component)
Assign a component for Flash render into

 o GetComponent
 public Component GetComponent()
Returns the component flash renders into

 o StopSound
 public void StopSound()
Turn of all currently playing sound

 o SetSoundMute
 public void SetSoundMute(boolean flag)
Mute the sound if flag is true else unmute it

 o SetTranslate
 public void SetTranslate(int xOffset,
                          int yOffset)
Sets the offset of the starting point where to draw the "Flash" movie in the component

 o GetTranslate
 public Point GetTranslate()
Gets the offset of the starting point where the "FLash" movie is drawn in the component

 o GetBounds
 public Rectangle GetBounds()
Returns the bounds of the "Flash" rendering area

 o SetLoop
 public void SetLoop(boolean loop)
Set the movie looping state. If set to true we loop forever.

 o SetQuality
 public void SetQuality(int quality,
                        boolean forceRedraw)
set rendering quality and forceRedraw if needed.

Parameters:
quality - can be QUALITY_LOW, QUALITY_AUTOLOW, QUALITY_AUTOHIGH, QUALITY_HIGH, QUALITY_BEST
See Also:
QUALITY_LOW, QUALITY_AUTOLOW, QUALITY_AUTOHIGH, QUALITY_HIGH, QUALITY_BEST
 o SetBgColor
 public void SetBgColor(int color)
set the background color of the "Flash" movie. Format of color is 0RGB (8 bits for each gun)

 o GetBgColor
 public int GetBgColor()
Get the background color of the "Flash" movie

See Also:
SetBgColor
 o Update
 public void Update(Graphics g)
Update event causes "FLash" to redraw itself. Note: Method name is capitalized

 o Paint
 public void Paint(Graphics g)
Paint event causes "FLash" to redraw itself. Note: Method name is capitalized

 o HandleEvent
 public boolean HandleEvent(Event evt)
Update event causes "FLash" to redraw itself. Returns true if Event was handled. Note: Method name is capitalized