本文介绍了AS3改变文本框里面的MovieClip从libray添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做到以下几点:

我有我的舞台的空MovieClip名为 zonaCentral_mc 。我用一个函数,有这个code:

  zonaCentral_DescripcionProceso =新zonaCentral_DescripcionProceso_mc();
zonaCentral_mc.addChild(zonaCentral_DescripcionProceso);
 

据加载影片剪辑的 zonaCentral_DescripcionProceso 从库中插入空影片剪辑的 zonaCentral_mc 。加载的MC有一个动态文本名为 titulo_text 里面。我怎样才能改变这种文字?我想:

<$p$p><$c$c>this["zonaCentral_mc"].getChildByName("zonaCentral_DescripcionProceso").getChildByName("titulo_text").text =你好;

但我得到的错误:#1010:一学期没有定义,没有属性

我也试着在标记的这个[zonaCentral_mc。zonaCentral_DescripcionProceso.titulo_text.text 具有相同的结果。

我是否访问了错误的方式?为什么不规定,我相信他们都定义,并在舞台上时,我叫了上述说法。任何想法?

解决方案

您实例化没有一个实例名称的影片剪辑中,这就是为什么你无法通过getChildByName访问它。

试试这个:

  zonaCentral_DescripcionProceso.name =zonaCentralChildClip;
...
。这[zonaCentral_mc] getChildByName(zonaCentralChildClip)titulo_text.text =你好;
 

但同时,我pretty的确保可以访问该文本字段,以及:

  zonaCentral_DescripcionProceso.titulo_text.text =你好;
 

请注意,如果你是 zonaCentral_DescripcionProceso 是一个影片剪辑,您可以访问文本字段没有getChildByName的方法。

干杯,罗布

I'm trying to do the following:

I have an empty movieClip in my stage called zonaCentral_mc. I use a function that has this code:

zonaCentral_DescripcionProceso = new zonaCentral_DescripcionProceso_mc();
zonaCentral_mc.addChild(zonaCentral_DescripcionProceso);

It loads the MovieClip zonaCentral_DescripcionProceso from the library into the empty movieclip zonaCentral_mc. The loaded MC has a dynamic textfield called titulo_text inside. How can I change that text? I'm trying:

this["zonaCentral_mc"].getChildByName("zonaCentral_DescripcionProceso").getChildByName("titulo_text").text = "hello";

but I get the error: #1010: One term is not defined and has no properties

I've also tried the dot notation this["zonaCentral_mc"].zonaCentral_DescripcionProceso.titulo_text.text with the same result.

Am I accessing it the wrong way? Why isn't it defined, I believe that they're all defined and in the stage when I call the above statement. Any ideas?

解决方案

the MovieClip you instantiate doesn't have an instance name, that's why you can't access it through "getChildByName".

Try this:

zonaCentral_DescripcionProceso.name = "zonaCentralChildClip";
...
this["zonaCentral_mc"].getChildByName("zonaCentralChildClip").titulo_text.text = "hello";

But also, I am pretty sure you can access the text field as well:

zonaCentral_DescripcionProceso.titulo_text.text = "hello";

Please note, if you're zonaCentral_DescripcionProceso is a MovieClip, you can access the text field without the "getChildByName" method.

Cheers,Rob

这篇关于AS3改变文本框里面的MovieClip从libray添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:36