set font size in dynamic text field

I can't believe this is so hard !!

//
// Routine to set the title & drop shadow font size
function setTextHeight(hei:Number):Void {
      hei = (hei == undefined) ? 24 : hei;
      //
      var style_fmt:TextFormat = new TextFormat();
      style_fmt.size = hei;
      //
      theTitle.setTextFormat(style_fmt);
      dropShadowA.setTextFormat(style_fmt);
      dropShadowB.setTextFormat(style_fmt);
}

The above code does not work.  HOW do I set the font size of a dynamic text field ?

Thanks
DonelsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh ChopraCommented:
Hi,

It is working at my end.
Could you upload a sample FLA for reviewing.

Rgds
Aneesh
0
DonelsonAuthor Commented:
0
DonelsonAuthor Commented:
Does the autoSize disable the font size ?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Aneesh ChopraCommented:
Link to file is broken.......
0
Aneesh ChopraCommented:
I have uploaded a samlple FLA to show that your code is working fine
download it here....
http://s46.yousendit.com/d.aspx?id=0WD0IPWJNOCD1296S2OPK1Z9HD

Rgds
Aneesh
0
DonelsonAuthor Commented:
Sorry, try my link now.

William
0
Aneesh ChopraCommented:
unable to see any textbox in niceTitle_test.fla output..
I have already complied "niceTitle.swf"

Please test the package you have uploaded first and explain how can I replicate the issue.

Rgds
Aneesh
0
DonelsonAuthor Commented:
Sorry! Very sorry!

Didn't have complete file set....

Please download the niceTitle.zip again to get the full set of files.

William


0
Aneesh ChopraCommented:
Ok, got the issue..

1.
setTextFormat is a method of textField not movieClip..
theTitle,dropShadowA & dropShadowB are actually movieClips,,
textfields are inside them..
here is the correct code...
---------
theTitle.theText.setTextFormat(style_fmt);
dropShadowA.theText.setTextFormat(style_fmt);
dropShadowB.theText.setTextFormat(style_fmt);
--------


2.
you must set the text first  and then use the setFormat
---------
niceTitle.setTitle(theTitle, Stage.width/2, 60, 600);
niceTitle.setTextHeight(40);
//
smallTitle.setTitle("The Knights of the Round Table vowing to seek the Sangreal", Stage.width/2, 82);
smallTitle.setTextHeight(12);
---------


Rgds
Aneesh
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aneesh ChopraCommented:
here I have uploaded a updated version for you..
http://s24.yousendit.com/d.aspx?id=3F6R82OGXZSFD3MIDP1Q7L6KF0


I have just added a new parameter in "setTitle" function to set the textHeight.

Rgds
Aneesh
0
DonelsonAuthor Commented:
Aneesh.

1) Of course, I am so stupid:   theTitle.THETEXT.setText !!  I will remember this in future.

2) I have set a default text size inside the niceTitle.fla which then sets the text height BEFORE we determine the width of the field for scaling, etc.

So...
   // Set textHeight first, then draw titles
   niceTitle.setTextHeight(24);
   niceTitle.setTitle("This is a title", Stage.width/2, 60);
   niceTitle.setTitle("This is another title", Stage.width/2, 75);
   niceTitle.setTitle("This is a title", Stage.width/2, 90);

   /// Set another size and draw a smaller title
   niceTitle.setTextHeight(18);
   niceTitle.setTitle("This is a very long, very bad title to demonstrate....", Stage.width/2, 105);

0
DonelsonAuthor Commented:

(Of course, if you wanted them all on-screen at once, you'd load separate copies of the Swf's )
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.