Skip to main content
Participant
August 9, 2011
Answered

Styling a dynamic text field

  • August 9, 2011
  • 2 replies
  • 440 views

Hi guys

I am having a problem styling a dynamic text (see code below) as the font and font size are not working on our movie.

Can you spot, what we could be doing wrong?

Thanks in advance
Andres


     
var count:Number = 10082145;
var maxNum:Number = 20082145;
var num:Number = 1;
this.createTextField("txt", this.getNextHighestDepth(), 900, 20, 100, 50) ;
txt.textColor = 0xFFFFFF;
var emphatic:TextFormat = new TextFormat();
emphatic.bold = true;
emphatic.size = 16;
emphatic.font = "Arial";
txt.setTextFormat(emphatic);

onEnterFrame = function () {
    count += num;
    if (count >= maxNum) {
        num = 0;
        txt.text = "20082145";
    } else {
        var v = count / (maxNum / 20082145);
        txt.text = v;
       
        var str = String(v);
        var io = str.indexOf('.');
        if (io == -1)
        {
            txt.text = v + '0';
        }
    }


   
};

This topic has been closed for replies.
Correct answer Ned Murphy

That is using AS2 code, so if your intentions are to use AS3, then find the AS3 code for styling a textfield.  Otherwise, you need to post in the AS1/2 forum... http://forums.adobe.com/community/flash/flash_actionscript

2 replies

Inspiring
August 9, 2011

HI,

     it is not proper pattern of writing function in as3, please check tutorial for writing function in as3.

Ned Murphy
Ned MurphyCorrect answer
Legend
August 9, 2011

That is using AS2 code, so if your intentions are to use AS3, then find the AS3 code for styling a textfield.  Otherwise, you need to post in the AS1/2 forum... http://forums.adobe.com/community/flash/flash_actionscript