To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-15-2004, 08:16 PM   #1
Beyond Flash
Member
 
Join Date: Jul 2002
Location: New Mexico
Posts: 83
dynamicly center text box

I need to keep a text box centered in the middle of the stage (horizontaly) no matter how wide the text box is (it will get bigger and smaller dynamically).


I also need:

How can I get a dynamic text box to always display the text at the bottom?
Similar to the "align bottom" with a cell in a table.


any help would be great.
__________________
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
Beyond Flash is offline   Reply With Quote
Old 10-15-2004, 08:21 PM   #2
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
The basic forumula for keeping something centered is:

thing._x = (Stage.width - thing._width)/2;

or, if you've precomputed the center coordinate, you can use:

centerCoordinate = Stage.width/2;
thing._x = centerCoordinate - thing._width/2;

If the text box is contained inside a movieclip, you can use the movieclip width. Otherwise, you can set the textfield to autosize and use the textWidth property instead of thing._width.

The basic forumula for keeping something bottom-aligned is:

thing._y = bottomCoordinate - thing._height;

Again, you can either contain the textfield in a movieclip, and use the movieclip height, or you can set the textfield to autosize and use the textHeight property.
__________________
jbum is offline   Reply With Quote
Old 10-15-2004, 08:33 PM   #3
Beyond Flash
Member
 
Join Date: Jul 2002
Location: New Mexico
Posts: 83
How would I go about using the texthight property?
__________________
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
Beyond Flash is offline   Reply With Quote
Old 10-15-2004, 08:49 PM   #4
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
Let's say your textfield is called myText.

When you initialize it, you set autoSize to true:

myText.text = 'initial text';
myText.autoSize = true;


When you change it, the textHeight property will tell you how tall it is.

myText.text = 'changed text';
myText._y = 200 - myText.textHeight;
__________________
jbum is offline   Reply With Quote
Old 10-15-2004, 09:10 PM   #5
Beyond Flash
Member
 
Join Date: Jul 2002
Location: New Mexico
Posts: 83
Got it
Thank you very much!!
__________________
Beyond Flash
Your one stop web shop
http://www.beyondflash.net
Beyond Flash is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:49 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.