如何访问在AS3 Flash变量,并将它们添加到现有的文本字段? [英] How do I access flashvars in AS3, and add them to an existing text field?

查看:313
本文介绍了如何访问在AS3 Flash变量,并将它们添加到现有的文本字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我已经认识到我所面临的主要问题是,我想这已经存在于一个影片剪辑或舞台上走线从FlashVar的文本字段。出于某种原因,它不会做。如何使一个pre-现有的文本字段改变以匹配FlashVar的文字?

I've come to realize the main problem I'm facing is that I want a text field that already exists in a movieclip or on the stage to take the string from a flashvar. For some reason it will not do that. How do I make a pre-existing text field change to match the flashvar text?

HTML:

<div id="flashContent">
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="29px" id="egnewsTicker" align="middle">
                <param name="movie" value="egnewsTicker.swf" />
                <param name="flashvars" value="newslisttest=this is my test" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#ffffff" />
                <param name="play" value="true" />
                <param name="loop" value="true" />
                <param name="wmode" value="transparent" />
                <param name="scale" value="showall" />
                <param name="menu" value="false" />
                <param name="devicefont" value="false" />
                <param name="salign" value="lt" />
                <param name="allowScriptAccess" value="sameDomain" />
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="egnewsTicker.swf" width="100%" height="29px">
                    <param name="movie" value="egnewsTicker.swf" />
                    <param name="quality" value="high" />
                    <param name="bgcolor" value="#ffffff" />
                    <param name="play" value="true" />
                    <param name="loop" value="true" />
                    <param name="wmode" value="transparent" />
                    <param name="scale" value="showall" />
                    <param name="menu" value="false" />
                    <param name="devicefont" value="false" />
                    <param name="salign" value="lt" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <param name="flashvars" value="newslisttest=this is my test" />
                <!--<![endif]-->
                    <a href="http://www.adobe.com/go/getflash">
                        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
                    </a>
                <!--[if !IE]>-->
                </object>
                <!--<![endif]-->
            </object>
        </div>

我知道这应该是一个简单的任务,而且我发现,举例说明一些网络文章,但我根本无法做,当我试图做我自己的code它的工作。所有我想要做的就是传递一个Flash变量字符串,并能够按名称使用AS3来访问它的闪存,但我似乎无法做到这一点。

I know this is supposed to be a simple task, and I have found several web articles that give examples, but I simply cannot make it work when I'm trying to do my own code. All I want to do is pass a flashvar string and be able to access it by name in flash using AS3, but I can't seem to accomplish that.

我想:

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
newsItem.newsHeadline.text = String(paramObj[varName]);

我也试过:

newsItem.newsHeadline.text = this.loaderInfo.parameters.newslisttest;

我没有尝试的作品,它始终只是停留空白。什么是技巧访问闪光灯AS3 Flash变量?我只是没有得到它,我无法找到一个很好的解释,任何地方......

Nothing I try works, it always just stays blank. What is the trick to accessing flashvars in flash as3? I'm just not getting it and I can't find a good explanation anywhere...

推荐答案

试试这个: stage.loaderInfo.parameters.yourparam stage.loaderInfo .parameters [yourparam]

你能不能发布您的html code,所以我们可以看到如何通过Flash变量到Flash。

Can you post your html code, so we can see how you pass the flashvars to Flash.

这篇关于如何访问在AS3 Flash变量,并将它们添加到现有的文本字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆