开发者

Can't get dynamic text to show update in flash, but trace works

开发者 https://www.devze.com 2023-04-05 01:13 出处:网络
I\'m using text that is set to \"dynamic text\". In actionscript 3 I tried: instancename.text = \"abc\";

I'm using text that is set to "dynamic text".

In actionscript 3 I tried:

    instancename.text = "abc";
    tr开发者_JAVA技巧ace(instancename.text);

Trace returns "abc" when I test the movie but the appearance of the text doesn't change.

In action script 2 I tried:

    var1 = "abc";
    instance1._text = "def";
    trace(var1 + instance1._text);

Trace returns "abcdef" when I test the movie but the appearance of the text doesn't change.

Thanks.


In actionscript 2, your lines should be

var1 = "abc";
instance1.text = "def";
trace(var1 + instance1.text);

(remove the _ char)

Moreover, try with

instance1.htmlText = "def";

this depends on how you have setup your textfield box.

Another important consideration: make sure that you have embedded the font in the textfield (Embed... button in Properties palette)


Try with a very, very basic approach, such as this:

var t:TextField = new TextField;
t.autoSize = TextFieldAutoSize.LEFT;
t.text = "hello world";
this.addChild( t );

trace( "hello world" );

If that works, then your problem is elsewhere. Some things to check:

  • Is the TextField added to the stage?
  • Is there anything covering the TextField?
  • Are you using embedded fonts (in which case that's a whole different problem)?

Put a border and a background colour on your TextField:

t.border = true;
t.background = true;
t.backgroundColor = 0xff000;

and see if you see that


May be you have to go to embed... (near the character adjustment under the fonts selector) font and check inside the boxes which you want it to display then press OK and try again. I had the same problem but now it works!

0

精彩评论

暂无评论...
验证码 换一张
取 消