/* * TextFieldFormatted class by Wade Walker. * wadedwalker.com/ * wadedwalker@gmail.com * * Copyright (c) 2006 - 2010 Wade Walker * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package com.wadedwalker { //--------------------------------------------------------------------------------------------------------------------------------------\\ //-------------------------------------------------------------- Imports ---------------------------------------------------------------\\ //--------------------------------------------------------------------------------------------------------------------------------------\\ import flash.text.TextField; import flash.text.TextFormat; public class TextFieldFormatted extends TextField { //--------------------------------------------------------------------------------------------------------------------------------------\\ public var textFormat:TextFormat; //--------------------------------------------------------------------------------------------------------------------------------------\\ public function TextFieldFormatted () { textFormat = new TextFormat(); } //--------------------------------------------------------------------------------------------------------------------------------------\\ //--------------------------------------------------------TextFormat GETTERS -----------------------------------------------------------\\ //--------------------------------------------------------------------------------------------------------------------------------------\\ public function get align():String { return textFormat.align } public function get blockIndent():Object { return textFormat.blockIndent } public function get bold():Object { return textFormat.bold } public function get bullet():Object { return textFormat.bullet } public function get color():Object { return textFormat.color } public function get font():String { return textFormat.font } public function get indent():Object { return textFormat.indent } public function get italic():Object { return textFormat.italic } public function get kerning():Object { return textFormat.kerning } public function get leading():Object { return textFormat.leading } public function get leftMargin():Object { return textFormat.leftMargin } public function get letterSpacing():Object { return textFormat.letterSpacing } public function get rightMargin():Object { return textFormat.rightMargin } public function get size():Object { return textFormat.size } public function get tabStops():Array { return textFormat.tabStops } public function get target():String { return textFormat.target } public function get underline():Object { return textFormat.underline } public function get url():String { return textFormat.url } //--------------------------------------------------------------------------------------------------------------------------------------\\ //--------------------------------------------------------TextFormat SETTERS -----------------------------------------------------------\\ //--------------------------------------------------------------------------------------------------------------------------------------\\ public function set align(val:String):void { textFormat.align = val; updateTextField() } public function set blockIndent(val:Object):void { textFormat.blockIndent = val; updateTextField() } public function set bold(val:Object):void { textFormat.bold = val; updateTextField() } public function set bullet(val:Object):void { textFormat.bullet = val; updateTextField() } public function set color(val:Object):void { textFormat.color = val; updateTextField() } public function set font(val:String):void { textFormat.font = val; updateTextField() } public function set indent(val:Object):void { textFormat.indent = val; updateTextField() } public function set italic(val:Object):void { textFormat.italic = val; updateTextField() } public function set kerning(val:Object):void { textFormat.kerning = val; updateTextField() } public function set leading(val:Object):void { textFormat.leading = val; updateTextField() } public function set leftMargin(val:Object):void { textFormat.leftMargin = val; updateTextField() } public function set letterSpacing(val:Object):void { textFormat.letterSpacing = val; updateTextField() } public function set rightMargin(val:Object):void { textFormat.rightMargin = val; updateTextField() } public function set size(val:Object):void { textFormat.size = val; updateTextField() } public function set tabStops(val:Array):void { textFormat.tabStops = val; updateTextField() } public function set target(val:String):void { textFormat.target = val; updateTextField() } public function set underline(val:Object):void { textFormat.underline = val; updateTextField() } public function set url(val:String):void { textFormat.url = val; updateTextField() } //--------------------------------------------------------------------------------------------------------------------------------------\\ public function updateTextField():void { this.defaultTextFormat = textFormat } } }