admin管理员组文章数量:1357702
I have a flash that municates with a javascript using ExternalInterface. I have converted this into HTML5 using swiffy. How do call the methods i have created in flash using javascript?
I have a flash that municates with a javascript using ExternalInterface. I have converted this into HTML5 using swiffy. How do call the methods i have created in flash using javascript?
Share Improve this question asked Jan 10, 2013 at 10:39 Jon FabianJon Fabian 2862 silver badges15 bronze badges3 Answers
Reset to default 7Here is an update to the answer for who is still looking: As of now, Swiffy 5.3 has already supported ExternalInterface. I am able to make javascript call from AS3 using:
ExternalInterface.call("jsFunction", args);
In js, you just need to declare the "jsFunction" :
<script>
function jsFunction(args) {
alert("Call from AS3");
}
</script>
For the reverse direction, calling from JS to AS3 through Swiffy can be achieved using this in AS3:
ExternalInterface.addCallback("nameForJS", closeFunction);
function closeFunction(s:String) {
trace("Received " + s + " from js");
}
In JS, you will need to get the DOM el that tight to swiffy, and execute the function from there:
document.getElementById("swiffycontainer").nameForJS();
Hope this helps!
As per the swiffy documentation, ExternalInterface is not supported for AS 2.0 or AS 3.0 by swiffy.
Please refer to:
ActionScript 2.0 support
ActionScript 3.0 support
Still, it is easy to call JavaScript function from AS3-to-HTML5-via-Swiffy :
var urlRequest : URLRequest = new URLRequest( "javascript:doRoo();" );
navigateToURL( urlRequest,'_self' );
What is the best way to call a function that was declared in AS3 pre-swiffy from JavaScript - basically the reverse?
本文标签: javascriptCalling a flash ExternalInterface in swiffyobjectStack Overflow
版权声明:本文标题:javascript - Calling a flash ExternalInterface in swiffyobject - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743967076a2570083.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论