Skip to main content
July 20, 2011
Question

i want to write text in graphics sprite

  • July 20, 2011
  • 1 reply
  • 1209 views

i want to write text in this sprite

i use thes method but not work when i add textfield to sprite the rect become very small

function drawRect():Sprite
        {
            var redRect:Sprite = new Sprite();
            redRect.graphics.beginFill(0xff0000);    // red
            redRect.graphics.drawRect(0,0,30, 30);
            redRect.graphics.endFill();
           
            var number:TextField =new TextField();
            number.text = "1";
           
            number.x= 15;
            number.y= 15;
            redRect.addChild(number);
           
            return redRect;
        }

This topic has been closed for replies.

1 reply

Adobe Employee
July 21, 2011

flash.text.TextField is not a class in TLF but in player runtime. Pls post it to http://forums.adobe.com/community/webplayers/flash_player

July 21, 2011

thanks for your reply

ok can i use tlf on it

how can i do this