I have already posted that here but, I think this (a single class that
is extending TextField) can help you as it is a kind of things Ive
already done (and I was bored to struggle with textfield, textformat,
style, etc).
I've extracted a text tool from my framework: SomaText.
It allows you to easily create TextField and apply styles from a
stylesheet, you can set a lot TextField and TextFormat properties
straight from the stylesheet if you wish. It is a single class that is
extending the TextField built-in one, very easy to use.
Quick intro:
http://www.soundstep.com/blog/2009/01/07/somatext-standalone/
Source:
http://www.soundstep.com/blog/downloads/somatext/
List of properties you can use in the stylesheet:
http://www.soundstep.com/somaprotest/www/#/stylesheet/css-properties/
And for the curious, SomaText is part of Soma (MVC Framework):
http://www.soundstep.com/somaprotest/
Hope it helps.
Romu
www.soundstep.com
Cor wrote:
OK, here are some options:
HTH
Cor
/*
Create in library: New Font
My embedded fonts have Linkage classes of "FFFInterface", "LasVegasD" and
"Wdings".
Both of these seemed to work for me.
Fonts should be on the develop PC
*/
//TextFormat example
var fmt1:TextFormat = new TextFormat();
fmt1.font = new FFFInterface().fontName;
fmt1.size = 18;
var fmt2:TextFormat = new TextFormat();
fmt2.font = new LasVegasD().fontName;
fmt2.size = 18;
var txt:TextField = new TextField();
txt.width = 400;
txt.embedFonts = true;
txt.text="ActionScript";
//set textformat from beginIndex to EndIndex
txt.setTextFormat(fmt1,0,6);
txt.setTextFormat(fmt2,6,12);
txt.y = 10;
addChild(txt);
//CSS Example
var style:StyleSheet = new StyleSheet();
var heading:Object = new Object();
heading.fontFamily = new Wdings().fontName;
heading.fontSize="24";
heading.fontWeight="bold";
heading.fontStyle="italic";
heading.color="#FF0000";
var body:Object = new Object();
body.fontFamily = new LasVegasD().fontName;
body.fontSize="24";
body.fontWeight="bold";
body.fontStyle="italic";
body.color="#0000FF";
style.setStyle(".heading", heading);
style.setStyle("body", body);
var label:TextField = new TextField();
label.width = 400;
label.embedFonts = true;
label.styleSheet=style;
label.htmlText="<body><span class='heading'>Hello</span> World...</body>";
label.y = 80;
addChild(label);
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders