简体   繁体   English

传递Flash参数

[英]passing flash parameters

i have a flash button and i want to pass the button link (after click) as parameter. 我有一个Flash按钮,我想将按钮链接(单击后)作为参数传递。 what is the best way to do it? 最好的方法是什么?

You can pass parameters along to Flash using flashvars . 您可以使用flashvars将参数传递给Flash。

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: 假设您要传递网站的URL以在用户单击按钮时导航到该URL,可以将以下参数添加到Flash <OBJECT> HTML标记中:

<param name="url" value="http://www.helloworld.com" />

In ActionScript, you can read this flashvar using this piece of code: 在ActionScript中,您可以使用以下代码读取此flashvar:

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 ) (从此博客文章借来的源示例)

这是在AS3中完成的方法:root.loaderInfo.parameters [“您要阅读的参数名称”];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM