Dynamic Text Problem
- Musician
-
Musician
- Member since: May. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
I cant seem to find a way to use actionscript to change the size of the text in a dynamic text box. I looked through several of my actionscript books but all I found was this one piece of code that was something like "styler = new TextFeild". and then "setTextFormat(styler)" but this requires a with statement for styler including every variable that a text has when all I need to change is the size. So if anyone knows a better way please let me know.
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs
- Musician
-
Musician
- Member since: May. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
seriously, why is it always so hard to find help around here.
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
you can do htmlText instead of text ... instead of textbox.text = something do textbox.htmlText=something
and then you'll be able to use STYLING TAGS like
<span style='font:Arial;font-size:20px;'> TEXT HERE</span>
- dELtaluca
-
dELtaluca
- Member since: Apr. 16, 2004
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
only way to do that is using a textformat
for example lets say the dynamic textbox has an INSTANCE name of txt (not the VARIABLE name, that isnt important)
var tf:TextFormat = new TextFormat();
tf.size = 20;
txt.setTextFormat(tf);
- Musician
-
Musician
- Member since: May. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
yah, funny thing tho, I never learned html even though I know Actionscript. so could you do a full script like how it would fit into the frame. Also I never knew you could do html in flash would there be any downsides?
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs
- dELtaluca
-
dELtaluca
- Member since: Apr. 16, 2004
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
oh yeh, forgot about html text, i like to use textformats tho.
- Musician
-
Musician
- Member since: May. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
k thanx guys, ill try that. one more question though, has anyone tried to do a video game collaboration yet?
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
- Musician
-
Musician
- Member since: May. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
At 7/23/05 05:28 AM, dELta_Luca wrote: only way to do that is using a textformat
for example lets say the dynamic textbox has an INSTANCE name of txt (not the VARIABLE name, that isnt important)
var tf:TextFormat = new TextFormat();
tf.size = 20;
txt.setTextFormat(tf);
wouldn't just be tf = new TextFormat;?
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs
- Inglor
-
Inglor
- Member since: Jan. 26, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (10,869)
- Block
-
- Forum Stats
- Member
- Level 17
- Blank Slate
nope, it's an empty constructor you need the ()
read my tutorial AS OOP if you REALLY care why
- Musician
-
Musician
- Member since: May. 19, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
oh whoops not I meant did it need the tf:TextFormat. or could the varialbe just be tf. I know I need parenthesis.
I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs
- dELtaluca
-
dELtaluca
- Member since: Apr. 16, 2004
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
yes the :TextFormat is not neccesary but it is good practice and has its benefits
its called strict data typing - something which is compulsory in languages like c and c++

