I need to upgrade some AS 2.0 code and could use some help.
In my HTML pages I have a short JS script that looks like this:
<script language="JavaScript" type="text/javascript">
function startImage(name) {
return 3;
}
</script>
And within the old AS 2 code:
// TEXTFIELD FOR TESTING PURPOSES
var testVarTxt:TextField = new TextField();
addChild(testVarTxt);
var getString:String;
// Communicate with the Javascript function "startImage"
getString = String(ExternalInterface.call("startImage", name));
// Change the string value to a number
var JStoFlash:Number = parseInt(getString);
testVarTxt.text = JStoFlash;
Does someone know how to rewrite this for AS 3? I need to use something like parseInt to convert the string to an integer, and, I’m not sure if I’m using the ExternalInterface call() in the correct manner for AS 3.0.