Thanks - I might try that script, but is embedding a font from a Class
script really need to be that complicated?  You said you hadn't checked
the script, I myself am not quite sure what it does, so hard to modify
for my use, especially not sure about lines like:

    container = container || {};

?  Especially when "container" is not a defined property in the class
you wrote - can you explain?  Thanks very much for your ideas and help!



Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Iv
>>Sent: Friday, March 10, 2006 11:00 AM
>>To: Flashcoders mailing list
>>Subject: Re[2]: [Flashcoders] Can't reference a library font from
inside
>>astaticclass (?)
>>
>>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
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
_______________________________________________
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