Hi all,
I’m just having some issues with dynamic text fields and was wondering if anyone could help me out. What I am trying to do is create a text field, which has a transparent black background.
Now, I’ve done it, but some weird and annoying things are happening.
First, for some reason the alpha resets to 1 when I mouse over the text field, even though there is no listener for that event in place. This is how its being done:
[AS]public function Title():void
{
this.text = “Title”;
this.blendMode = BlendMode.LAYER;
this.background = true;
this.backgroundColor = 0x000000;
this.alpha = 0.7;
this.selectable = false;
this.border = false;
// style
var myFormat:TextFormat = new TextFormat();
myFormat.size = 48;
myFormat.align = 'left';
myFormat.color = 0xFFFFFF;
myFormat.font = 'helvetica';
myFormat.leftMargin = 50;
this.setTextFormat(myFormat);
// events
this.addEventListener(Event.ADDED_TO_STAGE, this.staged);
this.addEventListener(MouseEvent.MOUSE_UP, this.MouseUp);
}
[/AS]
Second, is there some way to add padding to a text field in AS3? I mean, I can’t understand why they didn’t just include all the relevant css properties, can it be so hard to just center my text vertically inside of its container? I have leftMargin, why not topPadding?