Hello Jason,

>>From reading that article, what is SFM?
- Shared Fonts Manager www.sharedfonts.com about it.

MJ> Also, this is recommending using text fields placed off-stage which show
MJ> all the characters?  I wanted to just do this from a class and have
MJ> minimal interaction with the .fla - the article also seems written for
MJ> an older version of Flash.  Is this really the only way to reference a
MJ> font in the library from a static class?

In AS2 you can use special class for access to formats instead
_level0.fmt_container object

for example:

class FontsLibrary {

  private static var container:Object;

  public static function registerFormat (from_text_field:TextField):Void {
    container = container || {};
    if (!from_text_field.embedFonts) {
      return;
    }
    var t_fmt = from_text_field.getNewTextFormat();
    var name:String = t_fmt.font;
    if (t_fmt.bold) {
      name += "_bold";
    }
    if (t_fmt.italic) {
     name += "_italic";
    }
    container[name] = t_fmt;
  }

  public static function isRegistered (font:String, bold:Boolean, 
italic:Boolean):TextFormat {
    var name:String = t_fmt.font;
    if (t_fmt.bold) {
      name += "_bold";
    }
    if (t_fmt.italic) {
     name += "_italic";
    }

    if (container[name]) {
      return true;
    }
    return false;
  }

}

your class:

class com.icfconsulting.objects.SimpleTextField{
        public static function create(target_mc:MovieClip):TextField{
//(Note:I just want a simple text field, so values are hard coded for
now)
  var my_fmt:TextFormat = new TextFormat();
  my_fmt.font = "Swis";
  my_fmt.color = 0x000000;
  my_fmt.size = 16;
  target_mc.createTextField("tf_txt",0,20,20,200,20);
  target_mc.tf_txt.embedFonts = FontsLibrary.isRegistered("Swis", false, false);
..........


and in the FLA you need register formats, possible using class:


import FontsLibrary;
class TextFormatsHolder extends MovieClip {

  function TextFormatsHolder () {
    for (var i:String in this) {
      var text_field:TextField = TextField(this[i])
      FontsLibrary.registerFormat(text_field);
    }
    this.swapDepths(this._parent.getNextHighestDepth());
    this.removeMovieClip();
  }

}


add to library in FLA TextFormatsHolder class movieclip and add
textfields with embeded fonts.
don't set "export in first frame" and add this movieclip to timeline
after preloader.

it's just a principle of solution. script not checked.


-- 
Ivan Dembicki
____________________________________________________________________________
[EMAIL PROTECTED] |                                        | 
http://www.design.ru

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to