# Text field questions

**URL:** <https://forum.kirupa.com/t/text-field-questions/293086>\
**Category:** flash\
**Created:** [July 23, 2009, 2:54am UTC](https://forum.kirupa.com/t/text-field-questions/293086 "2009-07-23T02:54:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohan](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@rohan](https://forum.kirupa.com/u/rohan)\
**Post date:** [July 23, 2009, 2:54am UTC](https://forum.kirupa.com/t/text-field-questions/293086/1 "2009-07-23T02:54:18Z")

</div>

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?
