Reputation: 31
i have a flash button and i want to pass the button link (after click) as parameter. what is the best way to do it?
Upvotes: 0
Views: 1605
Reputation: 10064
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)
Upvotes: 1
Reputation: 1145
this is how it's done in AS3: root.loaderInfo.parameters[ "name of param you want to read" ];
Upvotes: 0