改变影片剪辑dyanmic文本字段AS3添加到舞台不工作? [英] Changing dyanmic text field in MovieClip added to stage by AS3 is not working?
问题描述
当我更改动态文本字段的文本值,则文本字段仅仅是将空白的,没有表现出新的价值。
When I change the text value of a dynamic text field, the text field is just going blank, not showing the new value.
我有标题由AS3添加到舞台dyanmicallygame_board的电影剪辑。 (阶段是空白的开始。)
I have a MovieClip titled "game_board" that is added to the stage dyanmically by AS3. (stage is blank to begin with.)
我有一个作为子项添加到game_board动态地AS3另一个影片剪辑名为stage_2。
I have another MovieClip titled "stage_2" that is added as a child to "game_board" dynamically by AS3.
stage_2包含了prebuilt板,上面有不同的动态文本字段。他们都有实例名称。例如文本1。 this.game_board.stage_2.text_1.text
的原始值为0。
"stage_2" contains a prebuilt board with different dynamic text fields on it. They all have instance names. For example "text_1". The original value of this.game_board.stage_2.text_1.text
is 0.
当我这样做:
this.game_board.stage_2.text_1.text = "test";
trace(this.game_board.stage_2.text_1.text); //succesfully shows new value, "test"
跟踪成功地展示了新的价值,但在舞台上,这是显示为0的文本字段,现在显示绝对没问题,它只是消失。我试图在运行的情况下的addChild
它被移到底层出于某种原因,但没有奏效。即使在舞台上只包含文本字段,它仍只是一片空白。
The trace succesfully shows the new value, however the text field on the stage, which was showing "0", now shows absolutely nothing, it just disappears. I tried running addChild
in case it was being moved to the bottom layer for some reason, but that didn't work. Even when the stage only contains that text field, it still just goes blank.
我是什么做错了吗?
推荐答案
试试这个:
this.game_board.stage_2.text_1.embedFonts = false;
this.game_board.stage_2.text_1.text = "test";
这happend因为Flash CS5中使用的embedFonts
默认情况下,因此,如果您没有设置字体在库中,然后将其连接到您的文档,闪光CS5将只嵌入字体是只在您的文本输入,可以做测试,如果你改变了文本1
从 0
的值 TE
和删除的embedFonts
你只会得到 TET
没有<$ C $ç>取值,使用的embedFonts
中的所有文本看到这样的:<一href="http://stackoverflow.com/questions/1744541/embedding-fonts-in-as3-dynamic-text-field-disappears">Embedding在AS3字体 - 动态文本字段消失
that happend because flash cs5 use embedFonts
by default, so if you didn't set a font in your library then attach it to your document, flash cs5 will only embed Fonts that are in your Text input only, you can do test if you change the value of text_1
from 0
to te
and remove embedFonts
you will only get tet
without s
, to use embedFonts
in all your text see this: Embedding Fonts in AS3 - Dynamic Text Field disappears
这篇关于改变影片剪辑dyanmic文本字段AS3添加到舞台不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!