Home >Web Front-end >JS Tutorial >Interactive implementation code of JavaScript and ActionScript_javascript skills

Interactive implementation code of JavaScript and ActionScript_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:21:561205browse
Copy code The code is as follows:




import flash.external.ExternalInterface;
public function invokeJavaScript():void
{
lblResult.text=ExternalInterface.call("returnTheName",txtName.text);
}
]]>








Add method in javascript in html page function returnTheName(a){return "success! " a};

The above is the method in as calling js

The following is the method in js calling as
Copy code The code is as follows:




import flash.external.ExternalInterface;
private function init():void
{
ExternalInterface.addCallback("addTo100",add);//Statement OK Called method
}
private function add():int
{
var i:int;
var sum:int=0;
for(i=1; i< ;100 ; i )
{
sum = i;
}
return sum;
}

]]>



Add
js file in the html page Upper method function addMethod{var s= JavaScriptCallActionScript.addTo100();alert(s);}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn