|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
com.jpackages.jflashplayer.FlashPanel
public class FlashPanel
This class provides functionality to display a Flash Player movie animation.
Example:
// specify your registration key if you have purchased a registered version FlashPanel.setRegistrationKey("AAAA-BBBB-CCCC-DDDD-EEEE-FFFF"); // install Flash 10 if that version is not already present FlashPanel.installFlash(); // specify the required version in case its not available FlashPanel.setRequiredFlashVersion("9"); FlashPanel flashPanel = new FlashPanel(new File("Movie.swf"));
Copyright (c) 2001-2009
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
QUALITY_HIGH
Animation high quality. |
static int |
QUALITY_LOW
Animation low quality. |
static int |
SCALE_EXACTFIT
Makes the entire movie visible in the specified area without trying to preserve the original aspect ratio. |
static int |
SCALE_NOBORDER
Scales the movie to fill the specified area, without distortion but possibly with some cropping, while maintaining the original aspect ratio of the movie. |
static int |
SCALE_SHOWALL
Makes the entire movie visible in the specified area without distortion, while maintaining the original aspect ratio of the movie. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
FlashPanel(java.io.File f)
Constructs a FlashPanel given a flash animation (swf) File. |
|
FlashPanel(java.io.File f,
boolean autoplay)
Constructs a FlashPanel given a flash animation (swf) File. |
|
FlashPanel(java.io.File f,
java.awt.Image image)
Constructs a FlashPanel given a flash animation (swf) File and alternate Image. |
|
FlashPanel(java.io.File f,
java.awt.Image image,
boolean autoplay)
Constructs a FlashPanel given a flash animation (swf) File and alternate Image. |
|
FlashPanel(java.net.URL u)
Constructs a FlashPanel given a flash animation (swf) URL. |
|
FlashPanel(java.net.URL u,
boolean autoplay)
Constructs a FlashPanel given a flash animation (swf) URL. |
|
FlashPanel(java.net.URL u,
java.awt.Image image)
Constructs a FlashPanel given a flash animation (swf) URL and alternate Image. |
|
FlashPanel(java.net.URL u,
java.awt.Image image,
boolean autoplay)
Constructs a FlashPanel given a flash animation (swf) URL and alternate Image. |
Method Summary | |
---|---|
void |
addFlashPanelListener(FlashPanelListener flashPanelListener)
Deprecated. For ActionScript 3, please use callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code.
Use ExternalInterface.call() in Flash and setFlashCallObject(java.lang.Object) to call Java methods from Flash. |
void |
addNotify()
This method should not be called. |
void |
back()
Go back one frame in the animation. |
java.lang.Object |
callFlashFunction(java.lang.String methodName,
java.lang.Object[] objects)
Calls a function in Flash ActionScript. |
void |
callFrame(int framenumber)
Deprecated. For ActionScript 3, please use callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code. |
void |
callFrame(java.lang.String label)
Deprecated. For ActionScript 3, please use callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code. |
void |
callFrame(java.lang.String timeline,
int framenumber)
Deprecated. For ActionScript 3, please use callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code. |
void |
callFrame(java.lang.String timeline,
java.lang.String label)
Deprecated. For ActionScript 3, please use callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code. |
void |
dispose()
Releases all of the native screen resources for this object. |
void |
forward()
Go forward one frame in the animation. |
java.awt.Color |
getBackground()
Retrieves the background Color. |
long |
getCurrentFrame()
Retrieves the current frame being displayed. |
boolean |
getLoop()
Retrieves if the animation is set to loop. |
boolean |
getMenuDisplay()
Retrieves if the animation right-click menu functionality is displayed. |
int |
getQuality()
Retrieves the animation quality as QUALITY_LOW or QUALITY_HIGH. |
long |
getTotalFrames()
Retrieves the total number of frames in the flash animation. |
java.lang.String |
getVariable(java.lang.String variable)
Deprecated. For ActionScript 3, please use the callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code. |
static boolean |
hasFlashVersion(java.lang.String version)
Retrieves if the system has the specified flash version. |
static boolean |
installFlash()
Installs the latest Flash on the system if it is not already present. |
static boolean |
installFlash(java.io.File flashocx,
java.lang.String versionRequired)
Installs flash from the specified ocx File. |
static boolean |
installFlash(java.lang.String versionRequired)
Installs the latest Flash on the system if it is not already present. |
boolean |
isNativeFlashDisplayed()
Determine if the native Flash Player has been loaded and successfully displayed. |
boolean |
isPlaying()
Retrieves if the flash animation is playing. |
void |
paint(java.awt.Graphics g)
Overridden paint method to draw alternate image if necessary. |
void |
play()
Play the animation from a stopped state. |
static boolean |
registerFlash(java.io.File flashocx,
java.lang.String versionRequired)
This method differs from the installFlash methods in that it does not copy the flash.ocx file anywhere. |
void |
removeFlashPanelListener(FlashPanelListener flashPanelListener)
Remove a FlashPanelListener from this FlashPanel. |
void |
rewind()
Rewind the animation to the beginning. |
void |
setBackground(java.awt.Color c)
Sets the background Color. |
boolean |
setCurrentFrame(long frame_index)
Set the current frame index to be displayed. |
void |
setFlashCallListener(FlashCallListener listener)
When the ActionScript function ExternalInterface.call() is executed in flash, the listener specified here will be notified. |
void |
setFlashCallObject(java.lang.Object object)
When the ActionScript function ExternalInterface.call() is executed in flash, the method it will try to call is on the object set here. |
void |
setLoop(boolean b)
Sets the animation to loop or not. |
void |
setMenuDisplay(boolean b)
Sets the animation right-click menu functionality to be displayed. |
void |
setMovie(java.io.File f)
Change the movie in this FlashPanel to a specified flash animation (swf) File. |
void |
setMovie(java.net.URL url)
Change the movie in this FlashPanel to a specified flash animation (swf) URL. |
void |
setQualityHigh()
Sets the animation quality to High. |
void |
setQualityLow()
Sets the animation quality to Low. |
static void |
setRegistrationKey(java.lang.String key)
When you purchase a registered version of JFlashPlayer, you must programmatically specify your registration key by passing it to this method. |
static void |
setRequiredFlashVersion(java.lang.String ver)
Specify the required version of flash before creating a FlashPanel. |
void |
setScale(int i)
Sets the movie scale behavior. |
void |
setVariable(java.lang.String variable,
java.lang.String value)
Deprecated. For ActionScript 3, please use callFlashFunction(java.lang.String, java.lang.Object[]) to communicate with Flash ActionScript code. |
void |
setVariables(java.lang.String variables)
This method should be called after FlashPanel is instantiated but before it is visible. |
void |
stop()
Stop the animation. |
static boolean |
uninstallFlash()
Uninstalls Flash if you used installFlash() or installFlash(String) to install. |
static boolean |
uninstallFlash(java.io.File flashocx)
Uninstalls flash using the specified ocx File. |
Methods inherited from class java.awt.Panel |
---|
getAccessibleContext |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int QUALITY_LOW
Animation low quality.
public static final int QUALITY_HIGH
Animation high quality.
public static final int SCALE_SHOWALL
Makes the entire movie visible in the specified area without distortion, while maintaining the original aspect ratio of the movie. Borders may appear on two sides of the movie.
public static final int SCALE_NOBORDER
Scales the movie to fill the specified area, without distortion but possibly with some cropping, while maintaining the original aspect ratio of the movie.
public static final int SCALE_EXACTFIT
Makes the entire movie visible in the specified area without trying to preserve the original aspect ratio. Distortion may occur.
Constructor Detail |
---|
public FlashPanel(java.net.URL u, java.awt.Image image)
Constructs a FlashPanel given a flash animation (swf) URL and alternate Image.
This constructor will autoplay the flash animation.
If there are any missing libraries or lack of Flash, the alternate Image will be displayed instead and stretched to the size of Panel.
u
- Flash animation (swf) URL which must be httpimage
- Alternate Image for display on errorpublic FlashPanel(java.net.URL u, java.awt.Image image, boolean autoplay)
Constructs a FlashPanel given a flash animation (swf) URL and alternate Image.
If there are any missing libraries or lack of Flash, the alternate Image will be displayed instead and stretched to the size of Panel.
u
- Flash animation (swf) URL which must be httpautoplay
- Automatically begin the playing of the flash animationimage
- Alternate Image for display on errorpublic FlashPanel(java.io.File f, java.awt.Image image)
Constructs a FlashPanel given a flash animation (swf) File and alternate Image.
This constructor will autoplay the flash animation.
If there are any missing libraries, lack of Flash, or file errors, the alternate Image will be displayed instead and stretched to the size of Panel.
f
- Flash animation (swf) Fileimage
- Alternate Image for display on errorpublic FlashPanel(java.io.File f, java.awt.Image image, boolean autoplay)
Constructs a FlashPanel given a flash animation (swf) File and alternate Image.
If there are any missing libraries, lack of Flash, or file errors, the alternate Image will be displayed instead and stretched to the size of Panel.
f
- Flash animation (swf) Fileautoplay
- Automatically begin the playing of the flash animationimage
- Alternate Image for display on errorpublic FlashPanel(java.net.URL u) throws JFlashLibraryLoadFailedException, JFlashInvalidFlashException
Constructs a FlashPanel given a flash animation (swf) URL.
This constructor will autoplay the flash animation.
u
- Flash animation (swf) URL which must be http
JFlashLibraryLoadFailedException
- A necessary library is missing (JFlash DLL or ATL DLL)
JFlashInvalidFlashException
- Required Flash version is not availablepublic FlashPanel(java.net.URL u, boolean autoplay) throws JFlashLibraryLoadFailedException, JFlashInvalidFlashException
Constructs a FlashPanel given a flash animation (swf) URL.
u
- Flash animation (swf) URL which must be httpautoplay
- Automatically begin the playing of the flash animation
JFlashLibraryLoadFailedException
- A necessary library is missing (JFlash DLL or ATL DLL)
JFlashInvalidFlashException
- Required Flash version is not availablepublic FlashPanel(java.io.File f) throws JFlashLibraryLoadFailedException, JFlashInvalidFlashException, java.io.FileNotFoundException
Constructs a FlashPanel given a flash animation (swf) File.
This constructor will autoplay the flash animation.
f
- Flash animation (swf) File
JFlashLibraryLoadFailedException
- A necessary library is missing (JFlash DLL or ATL DLL)
JFlashInvalidFlashException
- Required Flash version is not available
java.io.FileNotFoundException
- The specified File cannot be foundpublic FlashPanel(java.io.File f, boolean autoplay) throws JFlashLibraryLoadFailedException, JFlashInvalidFlashException, java.io.FileNotFoundException
Constructs a FlashPanel given a flash animation (swf) File.
f
- Flash animation (swf) Fileautoplay
- Automatically begin the playing of the flash animation
JFlashLibraryLoadFailedException
- A necessary library is missing (JFlash DLL or ATL DLL)
JFlashInvalidFlashException
- Required Flash version is not available
java.io.FileNotFoundException
- The specified File cannot be foundMethod Detail |
---|
public void addFlashPanelListener(FlashPanelListener flashPanelListener)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Use ExternalInterface.call() in Flash and setFlashCallObject(java.lang.Object)
to call Java methods from Flash.
Add a FlashPanelListener to this FlashPanel.
flashPanelListener
- The listener to addpublic void removeFlashPanelListener(FlashPanelListener flashPanelListener)
Remove a FlashPanelListener from this FlashPanel.
flashPanelListener
- The listener to removepublic static final void setRegistrationKey(java.lang.String key)
When you purchase a registered version of JFlashPlayer, you must programmatically specify your registration key by passing it to this method.
This static method should be called before anything else is done with this API as
follows:
FlashPanel.setRegistrationKey("AAAA-BBBB-CCCC-DDDD-EEEE-FFFF");
key
- Registration Keypublic void dispose()
Releases all of the native screen resources for this object. This is done automatically when this object is garbage collected but under some circumstances, it is preferable to not have to wait for garbage collection to destroy native resources.
public void addNotify()
This method should not be called. It is used internally to properly create a FlashPanel.
addNotify
in class java.awt.Panel
public void paint(java.awt.Graphics g)
Overridden paint method to draw alternate image if necessary. Should not be called by developer.
paint
in class java.awt.Container
public static void setRequiredFlashVersion(java.lang.String ver)
Specify the required version of flash before creating a FlashPanel. If the required flash version is unavailable, the constructor will throw a JFlashInvalidFlashException.
Example:
FlashPanel.setRequiredFlashVersion("7");
ver
- Flash version such as "7"public void setMovie(java.io.File f) throws java.io.FileNotFoundException
Change the movie in this FlashPanel to a specified flash animation (swf) File.
f
- Flash animation (swf) File
java.io.FileNotFoundException
- The specified File cannot be foundpublic void setMovie(java.net.URL url)
Change the movie in this FlashPanel to a specified flash animation (swf) URL.
url
- Flash animation (swf) URLpublic void play()
Play the animation from a stopped state.
NOTE: Animations start playing when a FlashPanel is created.
public void stop()
Stop the animation.
public void back()
Go back one frame in the animation. The animation will also stop so if you would like it to restart, use the play() method.
public void forward()
Go forward one frame in the animation. The animation will also stop so if you would like it to restart, use the play() method.
public void rewind()
Rewind the animation to the beginning. The animation will also stop so if you would like it to restart, use the play() method.
public boolean isPlaying()
Retrieves if the flash animation is playing.
public boolean setCurrentFrame(long frame_index)
Set the current frame index to be displayed.
This method will fail if the animation has not yet been visually displayed.
The animation will also stop so if you would like it to restart, use the play() method.
frame_index
- Index of the flash frame to display.
public long getTotalFrames()
Retrieves the total number of frames in the flash animation.
public long getCurrentFrame()
Retrieves the current frame being displayed.
public void setQualityLow()
Sets the animation quality to Low.
The default image quality is High.
public void setQualityHigh()
Sets the animation quality to High.
The default image quality is High.
public int getQuality()
Retrieves the animation quality as QUALITY_LOW or QUALITY_HIGH.
public void callFrame(java.lang.String timeline, int framenumber)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Call the frame actions for a specified frame in a given timeline.
timeline
- The timeline the frame is in. "/" is the main timeline.framenumber
- The index of the framepublic void callFrame(int framenumber)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Call the fram actions for a specified frame in the main timeline.
framenumber
- The index of the framepublic void callFrame(java.lang.String timeline, java.lang.String label)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Call the frame actions for a specified frame by its label in a given timeline.
timeline
- The timeline the frame is in. "/" is the main timeline.label
- The label of the framepublic void callFrame(java.lang.String label)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Call the frame actions for a specified frame by its label in the main timeline.
label
- The label of the framepublic boolean isNativeFlashDisplayed()
Determine if the native Flash Player has been loaded and successfully displayed.
Many methods such as setVariable and getVariable will only work once the native Flash Player has been successfully displayed.
public void setVariable(java.lang.String variable, java.lang.String value)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Set the value of a Flash variable.
variable
- Flash variablevalue
- The value assigned to the specified variable namepublic void setVariables(java.lang.String variables)
This method should be called after FlashPanel is instantiated but before it is visible. These variables will then be available at startup of the flash movie in ActionScript.
In ActionScript 3, you can access the variable name myVariable by root.loaderInfo.parameters.myVariable.
The string of variables should look like this:
myVariable=horse&myOtherVariable=1&myLastVariable=good%20job
For more information on setting this variables string, please visit this Adobe document.
variables
- Variables defined before the FlashPanel is visiblepublic java.lang.String getVariable(java.lang.String variable)
callFlashFunction(java.lang.String, java.lang.Object[])
to communicate with Flash ActionScript code.
Get the value of a Flash variable.
variable
- Flash variable
public void setScale(int i)
Sets the movie scale behavior.
Default is FlashPanel.SCALE_SHOWALL.
i
- int Scalepublic void setBackground(java.awt.Color c)
Sets the background Color.
setBackground
in class java.awt.Component
c
- Background Colorpublic java.awt.Color getBackground()
Retrieves the background Color.
getBackground
in class java.awt.Component
public void setLoop(boolean b)
Sets the animation to loop or not.
b
- set looppublic boolean getLoop()
Retrieves if the animation is set to loop.
public static boolean installFlash()
Installs the latest Flash on the system if it is not already present. As of JFlashPlayer 2.0, the included latest version is Flash 10.
It is highly recommended to receive user permission before using this method.
Use the uninstallFlash() method to unregister.
This method will only work on Windows XP/Vista.
This method requires the resource installflash.zip included in jflashplayer.jar to be included with your Java resources as well (such as in your application jar).
Keep in mind that Flash 10 does not work on older versions of Windows so be sure you are installing the right Flash version on the right OS.
public static boolean installFlash(java.lang.String versionRequired)
Installs the latest Flash on the system if it is not already present. As of JFlashPlayer 2.0, the included latest version is Flash 10.
It is highly recommended to receive user permission before using this method.
Use the uninstallFlash() method to unregister.
This method will only work on Windows XP/Vista.
This method requires the resource installflash.zip included in jflashplayer.jar to be included with your Java resources as well (such as in your application jar).
Keep in mind that Flash 10 does not work on older versions of Windows so be sure you are installing the right Flash version on the right OS.
versionRequired
- Flash version such as "9" that you require to be present
public static boolean installFlash(java.io.File flashocx, java.lang.String versionRequired)
Installs flash from the specified ocx File.
As of Flash Player 10, the ocx file is Flash10a.ocx and is located in the [WINDOWS SYSTEM32]\Macromed\Flash directory. JFlashPlayer does not include a Flash ocx file.
This method will copy the Flash ocx file to the above mentioned directory and register it to Windows for system-wide use.
If you do not want the file copied to the above mentioned directory, use the registerFlash method instead.
Example:
boolean installed = installFlash(new File("Flash10a.ocx", "10"));
It is highly recommended to receive user permission before using this method.
This method requires the resource installflash.zip included in jflashplayer.jar to be included with your Java resources as well (such as in your application jar) for it to work on Windows XP/Vista. For older versions of Windows, installflash.zip is not necessary.
Keep in mind that Flash 10 does not work on older versions of Windows to be sure you are installing the right Flash version on the right OS.
flashocx
- Flash.ocx FileversionRequired
- Flash version such as "9" that you require to be present
public static boolean uninstallFlash(java.io.File flashocx)
Uninstalls flash using the specified ocx File.
Flash is unregistered from Windows. No files are deleted.
flashocx
- Flash.ocx File
public static boolean uninstallFlash()
Uninstalls Flash if you used installFlash() or installFlash(String) to install.
Flash is unregistered from Windows.
public static boolean registerFlash(java.io.File flashocx, java.lang.String versionRequired)
This method differs from the installFlash methods in that it does not copy the flash.ocx file anywhere. That is up to the developer to do first as they see fit. This is a more manual approach that only registers the specified flash.ocx file with Windows for system-wide use.
It is highly recommended to receive user permission before using this method.
Use the uninstallFlash method to unregister.
flashocx
- Flash.ocx FileversionRequired
- Flash version such as "9"
public static boolean hasFlashVersion(java.lang.String version) throws JFlashLibraryLoadFailedException
Retrieves if the system has the specified flash version.
Example:
if (!hasFlashVersion("6")) installFlash(new File("Flash.ocx"));
version
- Flash version such as "7"
JFlashLibraryLoadFailedException
- A necessary library is missing (JFlash DLL or ATL DLL)public void setMenuDisplay(boolean b)
Sets the animation right-click menu functionality to be displayed.
The default is for the menu functionality to not be displayed.
NOTE: Even when set to false, there is a minimal right-click menu that cannot be removed.
b
- display menupublic boolean getMenuDisplay()
Retrieves if the animation right-click menu functionality is displayed.
public void setFlashCallObject(java.lang.Object object)
When the ActionScript function ExternalInterface.call() is executed in flash, the method it will try to call is on the object set here.
If the method is not found within the object, the ExternalInterface.call() function will receive a null response. An error message to standard error output will also be sent to help the developer see what method definition is needed.
Only setFlashCallObject or setFlashCallListener should be specified, not both. Setting this method will remove the FlashCallListener.
object
- The object where methods will be called from flash ActionScript codepublic void setFlashCallListener(FlashCallListener listener)
listener
- FlashCallListener to deal with ExternalInterface.call() function callspublic java.lang.Object callFlashFunction(java.lang.String methodName, java.lang.Object[] objects)
Calls a function in Flash ActionScript.
That function needs to be defined with ExternalInterface.addCallback(methodName, Object, flashFunction) in ActionScript.
The objects argument types correspond from Java objects to Flash data types in the following way.
Java Object Type | Flash Type |
---|---|
Boolean | Boolean |
Double | Number |
String | String |
String[] | Array |
Example:
String response = (String) flashPanel.callFlashFunction("flashFunctionName", new Object[] { "a string as first arg", new Boolean(false) });
For the above java code to work, your flash ActionScript would need to have the following example code:
var methodName:String = "flashFunctionName"; var method:Function = actualFunction; ExternalInterface.addCallback(methodName, method); function actualFunction(examplestring, exampleboolean):String { return "Howdy from flash: " + examplestring; }
methodName
- the name of the Flash ActionScript method defined with ExternalInterface.addCallbackobjects
- Arguments to pass to the Flash function in the form of Boolean, Integer, Long, Double, String, or String[]
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |