Thursday, November 3, 2011

Java Flash Player API - JFlashPlayer


Java Flash Player API - JFlashPlayer
Diambil dari : Java Flash Player API - JFlashPlayer

Cara menmpilkan Flash pada java
Only a few lines of code are needed to add JFlashPlayer to your Java programs:
FlashPanel.setRequiredFlashVersion("9");
FlashPanel flashPanel = new FlashPanel(new File("Movie.swf"));
To call a Flash function from Java, the Java code would look like this:
String val = (String) flashPanel.callFlashFunction("sayHello", new Object[] { "A string argument" });
And the flash ActionScript code would look like this:
var methodName:String = "sayHello"; 
var method:Function = actualFunction;
ExternalInterface.addCallback(methodName, method); 
function actualFunction(examplestring:String):String {
  return "Hello from Flash";
}
To call Java methods from Flash, the Flash ActionScript code would look like this:
var response:String = ExternalInterface.call("sayHi", "hi");
And the Java code would have this method definition:
public String sayHi(String text) {
  return "Aloha";
}
hana zm Web Developer

No comments:

Post a Comment