//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.core { import flash.text.TextField; import mx.utils.NameUtil; /** * FlexTextField is a subclass of the Player's TextField class * and the superclass of UITextField. * It overrides the toString() method * to return a string indicating the location of the object * within the hierarchy of DisplayObjects in the application. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class FlexTextField extends TextField { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * *

Sets the name property to a string * returned by the createUniqueName() * method of the mx.utils.NameUtils class.

* *

This string is the name of the object's class concatenated * with an integer that is unique within the application, * such as "UITextField18".

* * @see flash.display.DisplayObject#name * @see mx.utils.NameUtil#createUniqueName() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function FlexTextField() { super(); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { // The name assignment above can cause the RTE // Error #2078: The name property of a Timeline-placed // object cannot be modified. // if this class has been associated with an asset // that was created in the Flash authoring tool. // The only known case where this is a problem is when // an asset has another asset PlaceObject'd onto it and // both are embedded separately into a Flex application. // In this case, we ignore the error and toString() will // use the name assigned in the Flash authoring tool. } } //-------------------------------------------------------------------------- // // Overridden methods // //-------------------------------------------------------------------------- /** * Returns a string indicating the location of this object * within the hierarchy of DisplayObjects in the Application. * This string, such as "MyApp0.HBox5.UITextField18", * is built by the displayObjectToString() method * of the mx.utils.NameUtils class from the name * property of the object and its ancestors. * * @return A String indicating the location of this object * within the DisplayObject hierarchy. * * @see flash.display.DisplayObject#name * @see mx.utils.NameUtil#displayObjectToString() * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override public function toString():String { return NameUtil.displayObjectToString(this); } } }