Home > Web Front-end > JS Tutorial > body text

Interactive implementation code of JavaScript and ActionScript_javascript skills

WBOY
Release: 2016-05-16 18:21:56
Original
1178 people have browsed it
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);}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!