Return to Snippet

Revision: 12621
at March 21, 2009 11:04 by Wiederkehr


Initial Code
package {
	//--------------------------------------
	// IMPORT
	//--------------------------------------
	import flash.display.*;
	import flash.text.*;
	
	public class embedTest extends Sprite {

		[Embed(
		source='/fonts/DINOT-Regular.otf',
		fontName="DINOT-Regular",
		mimeType="application/x-font-truetype"
		)]
		private var pFont:Class;

		/**
		 *	@Constructor
		 */
		public function untitled():void{
			//  DEFINITIONS
			//--------------------------------------
			Font.registerFont(pFont);
		}
		private function createLink() : void {
			tf				= new TextField();
			tf.text		= 'foo';
			formatText(tf, T_COLOR, 12, true);
			tf.embedFonts		= true;
			this.addChild(tf);
		}
		private function formatText(_tf:TextField, _color:Number, _size:Number, _bold:Boolean = false) : void {
			var tFormat:TextFormat = new TextFormat();
			tFormat.font	= 'DINOT-Regular';
			tFormat.color	= _color;
			tFormat.size	= _size;
			tFormat.bold	= _bold;
			_tf.setTextFormat(tFormat);
		}
	} // END embedTest Class
} // END package

Initial URL


Initial Description


Initial Title
Text Embedding in AS3

Initial Tags
textmate

Initial Language
Other