FontsLoader

Kind of class: public class
Package:
Inherits from:
  • Sprite
Version: 19 Apr 2010 Added error handling 5 Apr 2010
Author: John Polacek, john@johnpolacek.com
Classpath: com.johnpolacek.text.FontsLoader
File last modified: Thursday, 24 February 2011, 22:09:57
The FontsLoader class loads fonts for runtime use.
Example

  • Load a single font:
    var loader:FontsLoader = new FontsLoader();
    loader.addEventListener(Event.COMPLETE, onFontsLoadComplete);
    loader.loadFont("fonts/GentiumFamily.swf");
    

    Load multiple fonts:
    var fontsArray:Array = new Array("fonts/GentiumFamily.swf","fonts/Andika.swf","fonts/GoodDog.swf");
    var loader:FontsLoader = new FontsLoader();
    loader.addEventListener(Event.COMPLETE, onFontsLoadComplete);
    loader.loadFonts(fontsArray);
    

Summary

Constructor
Instance methods
  • loadFonts (f:Array) : void
    • Loads multiple fonts from an array of url strings that
  • loadFont (fontURL:String) : void
    • Loads a single font from a url string points for swf
  • onFontLoadError (event:IOErrorEvent) : void

Constructor

FontsLoader

function FontsLoader()

Instance methods

loadFont

function loadFont(fontURL:String) : void

Loads a single font from a url string points for swf that contains an embedded font (i.e. "arial.swf")

Parameters
fontURL:URL of font swf

loadFonts

function loadFonts(f:Array) : void

Loads multiple fonts from an array of url strings that each point to a swf that contains an embedded font (i.e. "arial.swf")

Parameters
fonts:An array of font url strings

onFontLoadError

function onFontLoadError(event:IOErrorEvent) : void