  | |  | 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)
|
|
 |