View Full Version : Dynamically sizing text
masoth
03-03-2006, 08:53 PM
I'm trying to take dynamic text (I don't know how long it will be) and fit it into a certain space by changing the size of the text dynamically.
have any ideas?
oldnewbie
03-03-2006, 08:58 PM
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary729.html
masoth
03-03-2006, 11:06 PM
I've used autoSize but and centered it but it is still not working. Also the center doesn't work vertically - is there a way to center vertically?
sophistikat
03-03-2006, 11:10 PM
take a look at this and see if it helps
http://www.actionscript.org/tutorials/beginner/variables/index.shtml
Flash Gordon
03-03-2006, 11:41 PM
check out the thread called "pimp my text"
oldnewbie
03-03-2006, 11:48 PM
Why not post the link to it? Shhheeeeesssssssssssssssssssssshhhhh!
http://www.actionscript.org/forums/showthread.php3?t=97771
Flash Gordon
03-03-2006, 11:50 PM
why not look for yourself :rolleyes:
masoth
03-04-2006, 02:52 AM
Hey thanks for reply. Ok, its a little more complex than that. Here it is:
I have a tv screen that stays a certain size, say 300 x 300, and I load dynamic text which I don't know how long it'll be, the shorter the text is the bigger the size it is and the longer the smaller the size because it has to fit in the tv screen.
I'm also trying to make it vertically centered in the screen, horizontally is easy but I can't figure out vertical. wait maybe: tv._y+ - tv._height - text._height/2?
sophistikat
03-04-2006, 02:56 AM
can you post what you have because this sounds exactly like what i did in that post
oldnewbie
03-04-2006, 02:58 AM
And what post is that?
sophistikat
03-04-2006, 03:04 AM
And what post is that?i'm not too bright am i?
http://www.actionscript.org/forums/showpost.php3?p=454327&postcount=14
oldnewbie
03-04-2006, 03:07 AM
i'm not too bright am i?
http://www.actionscript.org/forums/showpost.php3?p=454327&postcount=14
Well after all, you are in Toronto, right? :D
Flash Gordon
03-04-2006, 03:24 AM
var T1:String = "Short Message.";
var T2:String = "I like the boob tub \nbecause sometimes \nI see boobs :)";
//
var num = Math.floor(Math.random()*2)+1;
_root.createTextField("_txt", 0, 0, 0, 0, 0);
_txt.autoSize = true;
_txt.multiline = true;
//
var F:TextFormat = new TextFormat();
F.size = 12;
// Oops.....I just realized this part is backwards from what you want.
// but hopefully you get the idea. :D
F.size += Math.floor(_root["T"+num].length / 4); // dynamic part here!
_txt.setNewTextFormat(F);
_txt.text = _root["T"+num];
S_h = 200; // Set Stage manuelly!
S_w = 200;
_txt._x = (S_w/2) - (_txt._width/2);
_txt._y = (S_h/2) - (_txt._height/2);
sophistikat
03-05-2006, 09:07 AM
Well after all, you are in Toronto, right? :Ddon't remind me...although its great watching the leafs lose every day this year and listening and watching the local media freak out about them no making the playoffs...ha!
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.