AS3 swf call javascript

Categories: dreamweaver, flash
Comments: No Comments
Published on: 2011/08/15
var r:URLRequest = new URLRequest("javascript:functionName()");
navigateToURL(r,'_self')

 

Call AS3 function from JS using ExternalInterface class

To call an Actionscript 3 function from Javascript:

import flash.external.ExternalInterface;

ExternalInterface.addCallback("changeText", changeTheText); // so javascript from html can talk to flash

function changeTheText(t:String):void {
	txtText.text = t;
}

 

延伸

http://www.hardcode.nl/archives_155/article_334-call-javascript-function-from-as3-and-viceversa

page 1 of 1

Views

Welcome , today is 星期六, 2024/11/23
Clef two-factor authentication