Most of examples about playing Flash animation on desktop application I found on the internet to are done by VB. But today I found java version. Flash SWT Plugin[ many thanks to Don Park ], it work very well on my latest project :).
To use Flash SWT Plugin, download com.docuverse.swt.flash-0.4.zip and extract it somewhere on local disk. Now our eclipse flash project need to add atleast two external jars e.g. flash.jar[from where we just extract the zip] and swt.jar and now we are ready to code.
THE SOURCE
To play swf file, all we need is FlashPlayer object and activate it that all. it'll look like this.
here is what it look like when running.
Note : SWT Flash only support on Windows.
To use Flash SWT Plugin, download com.docuverse.swt.flash-0.4.zip and extract it somewhere on local disk. Now our eclipse flash project need to add atleast two external jars e.g. flash.jar[from where we just extract the zip] and swt.jar and now we are ready to code.
THE SOURCE
To play swf file, all we need is FlashPlayer object and activate it that all. it'll look like this.
import com.docuverse.swt.flash.FlashPlayer;
public class SWTPlayer {
....
private void run() {
// TODO Auto-generated method stub
Display display = new Display();
Shell shell = new Shell(display);
FlashPlayer player = new FlashPlayer(shell);
player.loadMovie(0, "yourflashfile.swf");
player.setSize(550, 400);
player.activate();
shell.setSize(550, 400);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
here is what it look like when running.
Note : SWT Flash only support on Windows.
Comments