passing flash parameters
i have a flash button and i wa开发者_如何转开发nt to pass the button link (after click) as parameter. what is the best way to do it?
You can pass parameters along to Flash using flashvars.
Suppose you want to pass the URL of the website to navigate to when the user clicks a button, you can add the following parameter to your Flash <OBJECT>
HTML tag:
<param name="url" value="http://www.helloworld.com" />
In ActionScript, you can read this flashvar using this piece of code:
var flashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;
var url:String = "http://www.backupurl.com";
if (flashVars.url != undefined) {
url = flashVars.url;
}
(Source example borrowed from this blog article)
this is how it's done in AS3: root.loaderInfo.parameters[ "name of param you want to read" ];
精彩评论