Показать сообщение отдельно
Старый 31.03.2011, 04:15
in4core вне форума Посмотреть профиль Отправить личное сообщение для in4core Найти все сообщения от in4core
  № 2  
Ответить с цитированием
in4core
 
Аватар для in4core

Регистрация: Mar 2009
Сообщений: 4,219
Записей в блоге: 14
Дело в шляпе.
use it

Код AS3:
package com.in4core.utils 
{
	/**
	 * ...
	 * @author in4core
	 */
	public class FontAssets 
	{
 
		/*public static const LOWERCASE_SWEDISH_CHARS:String    = "U+00E5, U+00E4, U+00F6, U+00E9";
		public static const UPPERCASE_SWEDISH_CHARS:String    = "U+00C5, U+00C4, U+00D6, U+00C9";
		public static const NUMBER_CHARS:String         	  = "U+0030-U+0039";
		public static const UPPERCASE_A_TO_Z:String      	  = "U+0041-U+005A";
		public static const LOWERCASE_A_TO_Z:String     	  = "U+0061-U+007A";
		public static const PUNCTUATION:String          	  = "U+005B-U+0060";
		public static const STANDARD_SWEDISH:String           = LOWERCASE_A_TO_Z + ", " + UPPERCASE_A_TO_Z + ", " 
		+ LOWERCASE_SWEDISH_CHARS + ", " + UPPERCASE_SWEDISH_CHARS + ", " + NUMBER_CHARS + ", " + PUNCTUATION;*/
 
 
		[Embed(source = '../../../iFlash705.ttf', fontName = 'f_1'
		,fontFamily  = "iFlash"
		,fontStyle   ='normal'
		,fontWeight  = 'normal'
		,mimeType = "application/x-font-truetype"
		,embedAsCFF = 'false')]
		public static const i705:Class;
 
		[Embed(source = '../../../iFlash705b.ttf', fontName = 'f_2'
		,fontFamily  = "iFlash"
		,fontStyle   ='normal'
		,fontWeight  = 'bold'
		,mimeType = "application/x-font-truetype"
		,embedAsCFF = 'false')]
		public static const i705b:Class;
 
		[Embed(source = '../../../iFlash705Mono.ttf', fontName = 'f_3'
		,fontFamily  = "iFlash"
		,fontStyle   ='normal'
		,fontWeight  = 'normal'
		,mimeType = "application/x-font-truetype"
		,embedAsCFF = 'false')]
		public static const i705m:Class;
 
		[Embed(source = '../../../3593.ttf', fontName = 'f_4'
		,fontFamily  = ""
		,fontStyle   ='normal'
		,fontWeight  = 'normal'
		,mimeType = "application/x-font-truetype"
		,embedAsCFF = 'false')]
		public static const ver:Class;
 
	}
 
}
Код AS3:
package com.in4core.text 
{
	import flash.text.TextField;
	import flash.text.TextFormat;
	/**
	 * ...
	 * @author in4core
	 */
	public class DisplayText extends Object 
	{
		private static var _textfield:TextField;
 
 
		public static function registerFontsLibraries(fontAssets:Class)  : void
		{
			fontAssets;
		}
		public static function addField ( font:String = null , size:uint = 12, bitmapFonts:Boolean = false, 
 
		autosize:String = 'left', isMulti:Boolean = false, text:String = '' ) : TextField
 
		{
			_textfield = null;
 
			_textfield = new TextField();
 
			_textfield.defaultTextFormat = setFormat(size, font);
 
			_textfield.autoSize = autosize;
 
			_textfield.text = text;
 
			if (isMulti) _textfield.multiline = true;
 
			_textfield.selectable = false;
 
			if (!bitmapFonts) _textfield.antiAliasType = 'advanced';
 
			if (font != null) _textfield.embedFonts = true;
			else font = '_sans';
 
			return _textfield;
		}
 
		private static function setFormat( size:uint, font:String ):TextFormat {
 
			var tf:TextFormat = new TextFormat();
 
			tf.size = size;
 
			tf.font = font;
 
 
 
			return tf;
		}
 
	}
 
}
Подстрой под себя и пользуйся)) Это просто пример, как использую я

Код AS3:
DisplayText.registerFontLibraries(FontAssets);
 
var tf:TextField = DisplayText.addField('f_1' , 10 , false )
tf.text = 'text';
tf.textColor = 0xFF0000