/* * TextFieldFormatted class by Wade Walker. * wadedwalker.com * wadedwalker@gmail.com * * 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.utilities { //---------------------------------------------------------------------------------------------------------\\ import flash.text.TextField; import flash.text.TextFormat; //---------------------------------------------------------------------------------------------------------\\ /** * The TextFieldFormatted class is a regular TextField that has a built in TextFormat so that more options are available for styling. */ final public class TextFieldFormatted extends TextField { //---------------------------------------------------------------------------------------------------------\\ public var textFormat:TextFormat; //---------------------------------------------------------------------------------------------------------\\ final public function TextFieldFormatted () { textFormat = new TextFormat(); } //---------------------------------------------------------------------------------------------------------\\ final public function get align():String { return textFormat.align } final public function get blockIndent():Object { return textFormat.blockIndent } final public function get bold():Object { return textFormat.bold } final public function get bullet():Object { return textFormat.bullet } final public function get color():Object { return textFormat.color } final public function get font():String { return textFormat.font } final public function get indent():Object { return textFormat.indent } final public function get italic():Object { return textFormat.italic } final public function get kerning():Object { return textFormat.kerning } final public function get leading():Object { return textFormat.leading } final public function get leftMargin():Object { return textFormat.leftMargin } final public function get letterSpacing():Object { return textFormat.letterSpacing } final public function get rightMargin():Object { return textFormat.rightMargin } final public function get size():Object { return textFormat.size } final public function get tabStops():Array { return textFormat.tabStops } final public function get target():String { return textFormat.target } final public function get underline():Object { return textFormat.underline } final public function get url():String { return textFormat.url } //---------------------------------------------------------------------------------------------------------\\ final public function set align(val:String):void { textFormat.align = val; _updateTextField() } final public function set blockIndent(val:Object):void { textFormat.blockIndent = val; _updateTextField() } final public function set bold(val:Object):void { textFormat.bold = val; _updateTextField() } final public function set bullet(val:Object):void { textFormat.bullet = val; _updateTextField() } final public function set color(val:Object):void { textFormat.color = val; _updateTextField() } final public function set font(val:String):void { textFormat.font = val; _updateTextField() } final public function set indent(val:Object):void { textFormat.indent = val; _updateTextField() } final public function set italic(val:Object):void { textFormat.italic = val; _updateTextField() } final public function set kerning(val:Object):void { textFormat.kerning = val; _updateTextField() } final public function set leading(val:Object):void { textFormat.leading = val; _updateTextField() } final public function set leftMargin(val:Object):void { textFormat.leftMargin = val; _updateTextField() } final public function set letterSpacing(val:Object):void { textFormat.letterSpacing = val; _updateTextField() } final public function set rightMargin(val:Object):void { textFormat.rightMargin = val; _updateTextField() } final public function set size(val:Object):void { textFormat.size = val; _updateTextField() } final public function set tabStops(val:Array):void { textFormat.tabStops = val; _updateTextField() } final public function set target(val:String):void { textFormat.target = val; _updateTextField() } final public function set underline(val:Object):void { textFormat.underline = val; _updateTextField() } final public function set url(val:String):void { textFormat.url = val; _updateTextField() } //---------------------------------------------------------------------------------------------------------\\ final private function _updateTextField():void { this.defaultTextFormat = textFormat } } }