The Flash Player Java Edition plays back Flash 2 files using Java. To use the player in a web browser, it is easiest to use Aftershock to set create the applet tag needed. Refer to the Aftershock documentation for more information. Note that to use the Flash Java player with Flash 3, you must export your .swf files in the Flash 2 format.3,4,5都不支持,哎。。
to newman0708(nch): 我用FLASH.jar这个包可以在APPLET里播放FLASH V2,但是遇到的问题是,不能把用于播放的flashPlayer放到任何容器里去,我试了canvas,panel,没有试SWING,在CANVAS里,虽然用flashplayer.setcomponent(canvas),但是播放时CANVAS消失了! 而当flashplayer.setcomponent(panel)时,flash根本看不见! 不知道为什么,但是只要flashplayer.setcomponent(this),可以在APPLET默认的场景里播放FLASH QuickTime For java这个包如何,我试了一些SAMPLE,可以播放movie文件,包括FLASH4及其以下版本
你能把你能看到flash的applet程序帖出来看看吗?下面是我的程序。我连放在applet中也什么都看不见! import java.awt.*; import java.awt.event.*; import java.applet.*; import com.macromedia.flash.*; import java.io.*; /** * <p>Title: This follow is newman's writing</p> * <p>Description: I want better writing ,instead of best one!</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Shu</p> * @author Newman * @version 1.0 */public class Flash_Test_Applet extends Applet { boolean isStandalone = false; //Get a parameter value public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } //Construct the applet public Flash_Test_Applet() { } //Initialize the applet public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { FlashApi flashPlayer = new FlashApi(new Flash()); flashPlayer.SetComponent(this); flashPlayer.LoadScript(new FileInputStream("octopus.swf")); flashPlayer.Startup(); // flashPlayer.Play() ; System.out.println("component: "+flashPlayer.GetComponent().toString()); System.out.println("IsPlaying: "+flashPlayer.IsPlaying()); System.out.println("TotalFrames: "+flashPlayer.TotalFrames());
} //Get Applet information public String getAppletInfo() { return "Applet Information"; } //Get parameter info public String[][] getParameterInfo() { return null; } }
代码几乎一样,只不过我在startup后加了句.play() 仅此而已
startup后有和没有加.play() 我都 试过了,结果一样啊!都不能显示任何东西,真奇怪啊!
import java.awt.*; import java.awt.event.*; import java.applet.*; import com.macromedia.flash.*; import com.macromedia.*; import java.io.*;public class Applet1 extends Applet { private boolean isStandalone = false; //Get a parameter value public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } Canvas canvas; Panel panel; FlashApi flashPlayer; //Construct the applet public Applet1() { canvas = new Canvas(); canvas.setSize(300,400); canvas.setBackground(Color.red); } //Initialize the applet public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { } //Get Applet information public String getAppletInfo() { return "Applet Information"; } //Get parameter info public String[][] getParameterInfo() { return null; } public void start(){ this.add(canvas); flashPlayer = new FlashApi(new Flash()); flashPlayer.SetComponent(canvas); //这里把flashPlayer与canvas绑定,在canvas里播放的,问题你运行就会发现,falsh可以播放,canvas不见了 try{ flashPlayer.LoadScript(new FileInputStream("sample.swf"));//sample是我用flash里的sample,转成了v2 }catch(IOException ioe){ System.err.println(ioe.getMessage()); } flashPlayer.Startup(); //这里API手册的SAMPLE上给出的,后面还要play(),我就是在这里浪费了N多时间 flashPlayer.Play(); System.out.println(flashPlayer.IsPlaying()); } }
to keyinwind(winds): 我都拿你的代码运行了,还是不行,只是见到applet的颜色变成了红色,flash还是见不到。 现在唯一的可能性就是,我的flash.jar包有什么问题。我的email: [email protected]请你发一份flash.jar包给我吧! 我要用你的程序和你的包来试试看!
System.out.println("FlashVersion: "+flashPlayer.FlashVersion());
FlashVersion: 131073
System.out.println("FlashVersion: "+flashPlayer.FlashVersion());
FlashVersion: 131073
刚下了这个包,试试先!
Java. To use the player in a web browser, it is easiest to use
Aftershock to set create the applet tag needed. Refer to the
Aftershock documentation for more information. Note that to use
the Flash Java player with Flash 3, you must export your .swf
files in the Flash 2 format.3,4,5都不支持,哎。。
而且实际上客户端要安装FLASH PLAYER
用什么工具可以将FLASH的版本进行转换?
我用FLASH.jar这个包可以在APPLET里播放FLASH V2,但是遇到的问题是,不能把用于播放的flashPlayer放到任何容器里去,我试了canvas,panel,没有试SWING,在CANVAS里,虽然用flashplayer.setcomponent(canvas),但是播放时CANVAS消失了!
而当flashplayer.setcomponent(panel)时,flash根本看不见!
不知道为什么,但是只要flashplayer.setcomponent(this),可以在APPLET默认的场景里播放FLASH
QuickTime For java这个包如何,我试了一些SAMPLE,可以播放movie文件,包括FLASH4及其以下版本
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import com.macromedia.flash.*;
import java.io.*;
/**
* <p>Title: This follow is newman's writing</p>
* <p>Description: I want better writing ,instead of best one!</p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: Shu</p>
* @author Newman
* @version 1.0
*/public class Flash_Test_Applet extends Applet {
boolean isStandalone = false;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
} //Construct the applet
public Flash_Test_Applet() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
FlashApi flashPlayer = new FlashApi(new Flash());
flashPlayer.SetComponent(this);
flashPlayer.LoadScript(new FileInputStream("octopus.swf"));
flashPlayer.Startup();
// flashPlayer.Play() ;
System.out.println("component: "+flashPlayer.GetComponent().toString());
System.out.println("IsPlaying: "+flashPlayer.IsPlaying());
System.out.println("TotalFrames: "+flashPlayer.TotalFrames());
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
}
import java.awt.event.*;
import java.applet.*;
import com.macromedia.flash.*;
import com.macromedia.*;
import java.io.*;public class Applet1 extends Applet {
private boolean isStandalone = false;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
} Canvas canvas;
Panel panel;
FlashApi flashPlayer; //Construct the applet
public Applet1() {
canvas = new Canvas();
canvas.setSize(300,400);
canvas.setBackground(Color.red);
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
} public void start(){
this.add(canvas);
flashPlayer = new FlashApi(new Flash());
flashPlayer.SetComponent(canvas); //这里把flashPlayer与canvas绑定,在canvas里播放的,问题你运行就会发现,falsh可以播放,canvas不见了
try{
flashPlayer.LoadScript(new FileInputStream("sample.swf"));//sample是我用flash里的sample,转成了v2
}catch(IOException ioe){
System.err.println(ioe.getMessage());
}
flashPlayer.Startup(); //这里API手册的SAMPLE上给出的,后面还要play(),我就是在这里浪费了N多时间
flashPlayer.Play();
System.out.println(flashPlayer.IsPlaying());
}
}
我都拿你的代码运行了,还是不行,只是见到applet的颜色变成了红色,flash还是见不到。
现在唯一的可能性就是,我的flash.jar包有什么问题。我的email: [email protected]请你发一份flash.jar包给我吧!
我要用你的程序和你的包来试试看!