ooooh wise list,

im trying to apply a style to an html text field...with no luck.. please help!

first we tried doing it this way..

|[Embed(source="../fonts/||Interstate-Light||.ttf",
fontName="||Interstate-Light||", mimeType="application/x-font-truetype")]
public static const ||Interstate||TTF:String;

[Embed(source="../fonts/||Interstate-||Bold.ttf", fontWeight="bold",
fontName="||Interstate-||Bold||", mimeType="application/x-font-truetype")]
public static const ||Interstate||||BoldTTF:String;

[Embed(source="../fonts/||Interstate-||||Italic.ttf",
fontStyle="italic", fontName="||Interstate-||||Italic||",
mimeType="application/x-font-truetype")]
public static const ||Interstate||||ItalicTTF:String;


var defaultStyle:Object = new Object();
defaultStyle.fontFamily = "||Interstate||";

var style:StyleSheet = new StyleSheet();
style.setStyle(".defaultStyle", defaultStyle);

var t:TextField = new TextField();
t.embedFonts = true;
t.styleSheet = style;
t.htmlText = "<span class='defaultStyle'>My <b>bold</b> text</span>";

|
then we also tried it using CSS and embedding the font in a swf:


|package
{
  import flash.display.*;
  import flash.events.*;
  import flash.net.*;
  import flash.text.*;
[SWF(width='955', height='600', backgroundColor='#FFFFFF',
framerate='24')]

  public class Index extends Sprite
  {
      [Embed(
                  source="font.swf",
                  symbol="InterstateLight"
              )]
      private var ||Interstate||:Class;
public function Index()
      {
Font.registerFont(||Interstate-Light||); var style:StyleSheet = new StyleSheet(); var normal:Object = new Object();
          normal.color = "#FF4900";
          normal.fontFamily = "Interstate-Light";
          normal.fontLeading = 2;
          normal.fontSize = 11;

          var bold:Object = new Object();
          bold.color = "#FF4900";
          bold.fontFamily = "Interstate-Bold";
          bold.fontLeading = 2;
          bold.fontSize = 11;
          bold.fontWeight = "bold";
var italic:Object = new Object();
          italic.color = "#FF4900";
          italic.fontFamily = "Interstate-Italic";
italic.fontLeading = 2; italic.fontSize = 11; italic.fontStyle = "italic"; style.setStyle(".normal", normal);
          style.setStyle(".italic", italic);
          style.setStyle(".bold", bold);
var label:TextField = new TextField();
          label.antiAliasType = AntiAliasType.ADVANCED;
          label.autoSize = TextFieldAutoSize.LEFT;
          //label.embedFonts = true;
          label.multiline = true;
          label.styleSheet = style;
          label.htmlText = "<span class='||italic||'>HOLA HOLA HOLA
HOLA HOLA<br>HOLASSSS DDDD DDD<br><font
color='#000000'>HOLAAAAAAAAAAAAAAAAAAAAAAA</font></span>";
          addChild(label);
var tf:TextFormat = new TextFormat("||Interstate-Light||", 11)
          var label1:TextField = new TextField();
          label1.defaultTextFormat = tf;
          label1.antiAliasType = AntiAliasType.ADVANCED;
          label1.autoSize = TextFieldAutoSize.LEFT;
          label1.embedFonts = true;
          label1.multiline = true;
          label1.htmlText = "HOLA HOLA HOLA HOLA HOLA";
             label1.y = 100;
addChild(label1); }
  }
}


|any ideas?!
time sensitive project.. thanks

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to