Tuesday, January 15, 2008

Flash can talk to Javascript

this topic is a lot more complicated but here is an exaple of flash talkting to javascript
the actionscript code
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.external.ExternalInterface;

public class HelloWorld extends Sprite {

public function HelloWorld() {
var display_txt:TextField = new TextField();
display_txt.text = "Hello World!";
addChild(display_txt);
var param1:uint = 3;
var param2:uint = 7;
var result:uint = ExternalInterface.call("addNumbers", param1, param2);
display_txt.text = String(result);
}
}
}


No comments: