package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.external.*;
public class Jsfunction extends Sprite
{
public function Jsfunction():void
{
stage.addEventListener(MouseEvent.CLICK, clicked);
//The function "listening" to JS
ExternalInterface.addCallback("calledFromJs", calledFromJs);
}
private function clicked(e:MouseEvent):void
{
trace("hello");
ExternalInterface.call("calledFromAs3","Love JS and Love AS3");
}
public function calledFromJs(theVar):void
{
var tf = new TextField();
tf.y = 100;
tf.x = 100;
tf.height = 40;
tf.background = true;
tf.backgroundColor = "0x33DD44";
addChild(tf);
tf.text = theVar;
}
}
}
hi guys i am trying to get this as code to work alongside a javascript file,
it all works fine until i create a movieclip inside of the file where it says
1046: Type was not found or was not a compile-time constant: MovieClip.
1172: Definition flash.display.MovieClip could not be found.
any help at all?
thanks!