My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.hatch.utils
{
import flash.events.Event;
import flash.text.Font;

/**
* @author ahatch
*/
public class RuntimeFont extends RuntimeLibraryItem
{
public static var library:Array = new Array();

private var _name:String;

public function RuntimeFont(name:String, url:String, autoLoad:Boolean = false)
{
_name = name; // save the name of the font to be registered
super(url, autoLoad); // RuntimeLibraryItem class loads the swf
library.push(this); // store this in a static var of runtime fonts
}

private function registerFont():void
{
// registers with the Font class for use in the application
Font.registerFont( getClass(this.name) as Class );
}

override protected function handleLoadComplete(event:Event):void
{
// register the font when the swf loads
this.registerFont();
super.handleLoadComplete(event);
}

public function get name():String
{
// utility getter for whatever
return _name;
}
}
}

Change log

r79 by andyghatch on Jul 28, 2009   Diff
code comments
Go to: 
Project members, sign in to write a code review

Older revisions

r78 by andyghatch on Jul 28, 2009   Diff
ignore properties, lib class name
change, lib class cleanup
r76 by andyghatch on Jun 12, 2009   Diff
removed name var from base class
RuntimeClassLibrary
r73 by andyghatch on Jun 12, 2009   Diff
revised runtime class load scheme
All revisions of this file

File info

Size: 1002 bytes, 41 lines
Powered by Google Project Hosting