/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Draw background var square:Sprite = new Sprite(); addChild(square); square.graphics.beginFill(0x0000FF); square.graphics.drawRect(0,0,250,250); square.graphics.endFill(); //Draw textarea var myTextField:TextField = new TextField(); addChild(myTextField); myTextField.text = "some text here!\n Next line"; myTextField.width = 250; myTextField.height = 250; myTextField.border = false; var myFormat:TextFormat = new TextFormat(); myFormat.color = 0xAA0000; myTextField.setTextFormat(myFormat); //Set the text to the middle var middle:Number = myTextField.height /2; myTextField.y = middle - myTextField.textHeight;