Posted By

Pablo on 04/11/09


Tagged

TextField as3 Shape TextFormat


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

tspitzr
letmein_xxi


My first AS3


 / Published in: ActionScript 3
 

  1. var one:String="100";
  2. var two:Number= 200;
  3. trace(1+two);
  4. var three:String="3";
  5. trace(one+three);
  6. trace(Number(three)-Number(one));
  7.  
  8. var bgRed:Shape=new Shape();
  9. bgRed.graphics.beginFill(0xFF0000);
  10. bgRed.graphics.drawRect( Number(one), two,400,30);
  11. bgRed.graphics.endFill();
  12. addChild(bgRed);
  13.  
  14. var tf:TextFormat=new TextFormat();
  15. tf.color=0x000000;
  16. tf.font="Verdana";
  17. tf.size=17;
  18. tf.align="center";
  19.  
  20. var txt:TextField=new TextField();
  21. txt.text="Me Pablo";
  22. txt.x=bgRed.x;
  23. trace(bgRed.x);
  24. txt.y=0;
  25. txt.width=bgRed.width;
  26. txt.height=bgRed.height;
  27. txt.border=true;
  28. txt.setTextFormat(tf);
  29. addChild(txt);

Report this snippet  

You need to login to post a comment.