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.
-
PAN_PERCENT
- Pan mode
-
PAN_PIXELS
- Pan mode
-
QUALITY_AUTOHIGH
- Rendering Quality of the "Flash" movie
-
QUALITY_AUTOLOW
- Rendering Quality of the "Flash" movie
-
QUALITY_BEST
- Rendering Quality of the "Flash" movie
-
QUALITY_HIGH
- Rendering Quality of the "Flash" movie
-
QUALITY_LOW
- Rendering Quality of the "Flash" movie
-
FlashApi(Flash)
- Construct the api object
-
Back()
- Steps one frame back
-
CurrentFrame()
- Returns the current frame of the "Flash" movie
-
FlashVersion()
- Return Ver major in the high 16 bits
and ver minor in the low 16 bits
-
Forward()
- Setps one frame forward
-
FrameLoaded(int)
- Returns true if frame is loaded
-
GetBgColor()
- Get the background color of the "Flash" movie
-
GetBounds()
- Returns the bounds of the "Flash" rendering area
-
GetComponent()
- Returns the component flash renders into
-
GetTranslate()
- Gets the offset of the starting point where the "FLash"
movie is drawn in the component
-
GotoFrame(int)
- Goto a specific frame in the "Flash" movie
-
HandleEvent(Event)
- Update event causes "FLash" to redraw itself.
-
IsPlaying()
- Returns true if the animation thread is not paused
-
LoadScript(InputStream)
- Load "Flash" movie script using the
stream which point to the script itself.
-
Paint(Graphics)
- Paint event causes "FLash" to redraw itself.
-
Pan(int, int, int)
- Set the number of pixels to pan in the x, y derection
-
PercentLoaded()
- returns a number between 1 and 100
-
Play()
- Tells the animation thread to animate
-
Rewind()
- Rewind the movie to frame 0
-
SetBgColor(int)
- set the background color of the "Flash" movie.
-
SetComponent(Component)
- Assign a component for Flash render into
-
SetLoop(boolean)
- Set the movie looping state.
-
SetQuality(int, boolean)
- set rendering quality and forceRedraw
if needed.
-
SetSoundMute(boolean)
- Mute the sound if flag is true
else unmute it
-
SetTranslate(int, int)
- Sets the offset of the starting point where to draw
the "Flash" movie in the component
-
SetZoomRect(int, int, int, int)
- Zoom in on a rectangular area of the movie.
-
Shutdown()
- Destroys the animation thread
-
Startup()
- creates the animation thread
only used if the applet start()
is not used
-
StopPlay()
- Tells the animation thread to pause the animation
-
StopSound()
- Turn of all currently playing sound
-
TotalFrames()
- Returns the number of frames in a flash movie
-
Update(Graphics)
- Update event causes "FLash" to redraw itself.
-
Zoom(int)
- zomm into x and y direction by percent (ex: in order to double
you must pass in 50.
QUALITY_LOW
public static final int QUALITY_LOW
- Rendering Quality of the "Flash" movie
- See Also:
- SetQuality
QUALITY_AUTOLOW
public static final int QUALITY_AUTOLOW
- Rendering Quality of the "Flash" movie
- See Also:
- SetQuality
QUALITY_AUTOHIGH
public static final int QUALITY_AUTOHIGH
- Rendering Quality of the "Flash" movie
- See Also:
- SetQuality
QUALITY_HIGH
public static final int QUALITY_HIGH
- Rendering Quality of the "Flash" movie
- See Also:
- SetQuality
QUALITY_BEST
public static final int QUALITY_BEST
- Rendering Quality of the "Flash" movie
- See Also:
- SetQuality
PAN_PIXELS
public static final int PAN_PIXELS
- Pan mode
- See Also:
- Pan
PAN_PERCENT
public static final int PAN_PERCENT
- Pan mode
- See Also:
- Pan
FlashApi
public FlashApi(Flash flash)
- Construct the api object
- Parameters:
- flash - The context we are interfacing with
GotoFrame
public synchronized void GotoFrame(int frame)
- Goto a specific frame in the "Flash" movie
Rewind
public void Rewind()
- Rewind the movie to frame 0
Back
public void Back()
- Steps one frame back
Forward
public void Forward()
- Setps one frame forward
IsPlaying
public boolean IsPlaying()
- Returns true if the animation thread is not paused
Play
public void Play()
- Tells the animation thread to animate
FlashVersion
public int FlashVersion()
- Return Ver major in the high 16 bits
and ver minor in the low 16 bits
CurrentFrame
public int CurrentFrame()
- Returns the current frame of the "Flash" movie
TotalFrames
public int TotalFrames()
- Returns the number of frames in a flash movie
FrameLoaded
public boolean FrameLoaded(int frame)
- Returns true if frame is loaded
PercentLoaded
public int PercentLoaded()
- returns a number between 1 and 100
StopPlay
public void StopPlay()
- Tells the animation thread to pause the animation
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
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.
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.
Startup
public synchronized void Startup()
- creates the animation thread
only used if the applet start()
is not used
Shutdown
public void Shutdown()
- Destroys the animation thread
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.
SetComponent
public void SetComponent(Component component)
- Assign a component for Flash render into
GetComponent
public Component GetComponent()
- Returns the component flash renders into
StopSound
public void StopSound()
- Turn of all currently playing sound
SetSoundMute
public void SetSoundMute(boolean flag)
- Mute the sound if flag is true
else unmute it
SetTranslate
public void SetTranslate(int xOffset,
int yOffset)
- Sets the offset of the starting point where to draw
the "Flash" movie in the component
GetTranslate
public Point GetTranslate()
- Gets the offset of the starting point where the "FLash"
movie is drawn in the component
GetBounds
public Rectangle GetBounds()
- Returns the bounds of the "Flash" rendering area
SetLoop
public void SetLoop(boolean loop)
- Set the movie looping state. If set to true we loop forever.
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
SetBgColor
public void SetBgColor(int color)
- set the background color of the "Flash" movie.
Format of color is 0RGB (8 bits for each gun)
GetBgColor
public int GetBgColor()
- Get the background color of the "Flash" movie
- See Also:
- SetBgColor
Update
public void Update(Graphics g)
- Update event causes "FLash" to redraw itself.
Note: Method name is capitalized
Paint
public void Paint(Graphics g)
- Paint event causes "FLash" to redraw itself.
Note: Method name is capitalized
HandleEvent
public boolean HandleEvent(Event evt)
- Update event causes "FLash" to redraw itself. Returns true
if Event was handled.
Note: Method name is capitalized