Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
TextFormat stylesheet

TextFormat stylesheet

2004-02-15       - By Jamie Gregory

 Back
Hi,

The thing I want is to have a central place of all my text formats. Like a
stylesheet in HTML. It seems overkill to define all TextFormats in each
static function call. But it tells me that static functions can 't access
class instance vars. So... :(

Is this the optimal way to do it?

...

[code]

// ---- com/application/TextFormats.as

class com.application.TextFormats {

   // constructor
   function TextFormats(){}

   public static function assign(mNewTextFormat:String):TextFormat{
      // regulars
      var txtfmtVerdanaRegular12:TextFormat = new TextFormat();
      with(txtfmtVerdanaRegular12){
         font = "Verdana ";
         size = "12 ";
         color = "0x000000 ";
         leading = 0;
      }
      var txtfmtVerdanaRegular18:TextFormat = new TextFormat();
      with(txtfmtVerdanaRegular18){
         font = "Verdana ";
         size = "18 ";
         color = "0xaea98e ";
      }


      return eval(mNewTextFormat);
   }

}


// ---- com/application/Application.as

...

myText.setTextFormat(TextFormats.assign( "txtfmtVerdanaRegular12 "));

...

[/code]

Thanks
/Jamie

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
F?alle de nye og sjove ikoner med MSN Messenger http://messenger.msn.dk/


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104291
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)