PDA

View Full Version : textfield fontsize probably simple please help


roodkapje
04-01-2003, 11:06 AM
ah, my first post... glad to find you all here....

if somebody doesn't help me i'm gonna cry...
before you say, "that won't solve your problem" understand that i've been working on this site for threew= weeks straight.
i've got actionscript coming out of my hair follicles!!! AAA!!!

so yeah, um... heres the problem...
i hope someone can tell me what i am doing wrong.

i need to change the size of a font depending on how much text is loaded into a text box (from an xml file) the font is i guess what one calls ėmbedded meaning i specified it to be included with the flash movie here is my code so far:

if ( thisTxt != "" ){
thurston.teenAgeRiot = thisTxt
if ( thisTxt.length < 100 ){
thisTextFormat = new TextFormat();
thisTextFormat.size = 80;
thurston.teenAgeRiot.setTextFormat(thisTextFormat) ;
}
else {
thisTextFormat = new TextFormat();
thisTextFormat.size = 20;
thurston.teenAgeRiot.setTextFormat(thisTextFormat) ;
}
}
else {
thurston.teenAgeRiot = ""
}

}

i've never tried to use this setTextFormat thingy before so i am understandable confuuuuused :confused:

Billy T
04-01-2003, 11:23 AM
so what's it doing?

looks like you've got an else statement without an if statement but maybe you didnt post all the code...

roodkapje
04-01-2003, 11:33 AM
i didn't post everything, i couldn't possibly....
but what maddness you see there is an 'if/else' statement inside an 'if/else' statement

IF there is txt (thisTxt != "")
then go ahead and print it
then
IF the txt.length is < 100 (characters?)
then make it one size ....
ELSE make it a different size
otherwise ELSE
don't print anything (because there was no txt, see first IF statement)

*eep!:confused:

Billy T
04-01-2003, 11:40 AM
well you have one too many } for that to be the case but anyway...

what's it doing wrong?

roodkapje
04-01-2003, 11:43 AM
alright, for the sake of my sanity and anyone elses who has a problem of this sort i willl tell you how it was solved.

i had to call the Instance Name of the text filed, which in this case is 'starPower' and *not* the Variable Name which in this case is 'teenAgeRiot'

sorry, knew it was something simple... i am new to using MX... didn't have that Instance Name on a text field thing in my day ;)

thank you anyway.