This is a simple Hack for flash Dynamic Text Field With AS2 Where Vertical Text Align is not supported.
Instated of setting Text Vertically align we can position Text Field vertically Center by Y axis Position .
Steps : Add Follwing code in on layer action
//To get Empty text field height
blank_height = TextField_instance._height;
//Setting Text to text field
TextField_instance.text = "This text is vertically align";
//Adding autosize to text field
TextField_instance.autoSize = "center";
//for Vertical Alignment
TextField_instance._y = TextField_instance._y + (blank_height -TextField_instance._height) / 2;
Thanks,
Cheers.... :)
Instated of setting Text Vertically align we can position Text Field vertically Center by Y axis Position .
Steps : Add Follwing code in on layer action
//To get Empty text field height
blank_height = TextField_instance._height;
//Setting Text to text field
TextField_instance.text = "This text is vertically align";
//Adding autosize to text field
TextField_instance.autoSize = "center";
//for Vertical Alignment
TextField_instance._y = TextField_instance._y + (blank_height -TextField_instance._height) / 2;
Thanks,
Cheers.... :)
Thanks for this! Works like a charm :)
ReplyDeleteYou need to take in account the fact that textHeight might be smaller than the textfield height therefore the correct code for the last line is:
ReplyDeleteTextField_instance._y = TextField_instance._y + (blank_height -TextField_instance.textHeight) / 2;
Thanks for indicating the way :)
ReplyDeleteAwesome! Thanks!
ReplyDelete
ReplyDeletenice blog..Thanks for sharing the information.keep update with your blogs..
web designers in warangal
web designing company in warangal
best web designing company in warangal