http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/77148f4a/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as ---------------------------------------------------------------------- diff --cc frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as index f455a5c,0000000..bf66b1e mode 100644,000000..100644 --- a/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as +++ b/frameworks/projects/MX/src/main/flex/mx/core/UIComponent.as @@@ -1,15039 -1,0 +1,15039 @@@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.accessibility.Accessibility; +import flash.accessibility.AccessibilityProperties; +import flash.display.BlendMode; +*/ +import flex.display.TopOfDisplayList; +import flex.events.Event; +import flex.events.EventPhase; +import flex.ui.Keyboard; + +import org.apache.flex.events.Event; - COMPILE::AS3 ++COMPILE::SWF +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + import flash.display.InteractiveObject; +// import flash.display.Sprite; + import flash.display.GradientType; + import flash.display.Graphics; + import flash.display.Loader; + import flash.events.Event; + import flash.geom.Matrix; + import flash.geom.Matrix3D; +} +COMPILE::JS +{ + import flex.display.DisplayObject; + import flex.display.DisplayObjectContainer; + import flex.display.InteractiveObject; + import flex.display.Graphics; + import flex.display.Loader; +} +import flex.display.Sprite; +/* +import flash.display.Shader; +*/ +import mx.events.FocusEvent; +import mx.events.KeyboardEvent; +/* +import flash.events.IEventDispatcher; +import flash.geom.ColorTransform; +import flash.geom.PerspectiveProjection; +*/ +import org.apache.flex.geom.Point; +import org.apache.flex.geom.Rectangle; +import org.apache.flex.utils.PointUtils; +/* +import flash.geom.Transform; +import flash.geom.Vector3D; +import flash.system.ApplicationDomain; +import flash.system.Capabilities; +import flash.utils.Dictionary; +*/ +import flex.text.TextLineMetrics; - COMPILE::AS3 ++COMPILE::SWF +{ + import flash.text.TextFormatAlign; +} +COMPILE::JS +{ + import flex.text.TextFormatAlign; +} +import org.apache.flex.reflection.getQualifiedClassName; + +import mx.automation.IAutomationObject; +import mx.binding.Binding; +import mx.binding.BindingManager; +import mx.binding.FunctionReturnWatcher; +import mx.binding.PropertyWatcher; +import mx.binding.Watcher; +import mx.binding.StaticPropertyWatcher; +import mx.binding.XMLWatcher; +import mx.controls.IFlexContextMenu; +import mx.core.LayoutDirection; +import mx.effects.EffectManager; +import mx.effects.IEffect; +import mx.effects.IEffectInstance; +import mx.events.ChildExistenceChangedEvent; +import mx.events.DynamicEvent; +import mx.events.EffectEvent; +import mx.events.FlexEvent; +import mx.events.MoveEvent; +import mx.events.PropertyChangeEvent; +import mx.events.ResizeEvent; +import mx.events.StateChangeEvent; +import mx.events.ValidationResultEvent; +/* +import mx.filters.BaseFilter; +import mx.filters.IBitmapFilter; +*/ +import mx.geom.RoundedRectangle; +/* +import mx.geom.Transform; +import mx.geom.TransformOffsets; +import mx.graphics.shaderClasses.ColorBurnShader; +import mx.graphics.shaderClasses.ColorDodgeShader; +import mx.graphics.shaderClasses.ColorShader; +import mx.graphics.shaderClasses.ExclusionShader; +import mx.graphics.shaderClasses.HueShader; +import mx.graphics.shaderClasses.LuminosityShader; +import mx.graphics.shaderClasses.SaturationShader; +import mx.graphics.shaderClasses.SoftLightShader; +*/ +import mx.managers.CursorManager; +import mx.managers.ICursorManager; +import mx.managers.IFocusManager; +import mx.managers.IFocusManagerComponent; +import mx.managers.IFocusManagerContainer; +import mx.managers.ILayoutManagerClient; +import mx.managers.ISystemManager; +import mx.managers.IToolTipManagerClient; +import mx.managers.SystemManagerGlobals; +import mx.managers.SystemManager; +import mx.managers.ToolTipManager; +import mx.resources.IResourceManager; +import mx.resources.ResourceManager; +import mx.states.State; +import mx.states.Transition; +import mx.styles.CSSStyleDeclaration; +import mx.styles.IAdvancedStyleClient; +import mx.styles.ISimpleStyleClient; +import mx.styles.IStyleClient; +import mx.styles.IStyleManager2; +import mx.styles.StyleProtoChain; +import mx.styles.StyleManager; +import mx.utils.ColorUtil; +import mx.utils.GraphicsUtil; +/* +import mx.utils.MatrixUtil; +*/ +import mx.utils.NameUtil; +import mx.utils.StringUtil; +/* +import mx.utils.TransformUtil; +*/ +import mx.validators.IValidatorListener; +import mx.validators.ValidationResult; + +use namespace mx_internal; + +import flex.system.DefinitionManager; +import org.apache.flex.events.EventDispatcher; +import org.apache.flex.events.IEventDispatcher; + +// Excluding the property to enable code hinting for the layoutDirection style +[Exclude(name="layoutDirection", kind="property")] + +//-------------------------------------- +// Lifecycle events +//-------------------------------------- + +/** + * Dispatched when the component is added to a container as a content child + * by using the <code>addChild()</code>, <code>addChildAt()</code>, + * <code>addElement()</code>, or <code>addElementAt()</code> method. + * If the component is added to the container as a noncontent child by + * using the <code>rawChildren.addChild()</code> or + * <code>rawChildren.addChildAt()</code> method, the event is not dispatched. + * + * <p>This event is only dispatched when there are one or more relevant listeners + * attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.ADD + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="add", type="mx.events.FlexEvent")] + +/** + * Dispatched when the component has finished its construction, + * property processing, measuring, layout, and drawing. + * + * <p>At this point, depending on its <code>visible</code> property, + * the component is not visible even though it has been drawn.</p> + * + * @eventType mx.events.FlexEvent.CREATION_COMPLETE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="creationComplete", type="mx.events.FlexEvent")] + +/** + * Dispatched when an object has had its <code>commitProperties()</code>, + * <code>measure()</code>, and + * <code>updateDisplayList()</code> methods called (if needed). + * + * <p>This is the last opportunity to alter the component before it is + * displayed. All properties have been committed and the component has + * been measured and layed out.</p> + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.UPDATE_COMPLETE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="updateComplete", type="mx.events.FlexEvent")] + +/** + * Dispatched when an object's state changes from visible to invisible. + * + * <p>This event is only dispatched when there are one or more relevant listeners + * attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.HIDE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="hide", type="mx.events.FlexEvent")] + +/** + * Dispatched when the component has finished its construction + * and has all initialization properties set. + * + * <p>After the initialization phase, properties are processed, the component + * is measured, laid out, and drawn, after which the + * <code>creationComplete</code> event is dispatched.</p> + * + * @eventType mx.events.FlexEvent.INITIALIZE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="initialize", type="mx.events.FlexEvent")] + +/** + * Dispatched when the object has moved. + * + * <p>You can move the component by setting the <code>x</code> + * or <code>y</code> properties, by calling the <code>move()</code> + * method, by setting one + * of the following properties either on the component or on other + * components such that the LayoutManager needs to change the + * <code>x</code> or <code>y</code> properties of the component:</p> + * + * <ul> + * <li><code>minWidth</code></li> + * <li><code>minHeight</code></li> + * <li><code>maxWidth</code></li> + * <li><code>maxHeight</code></li> + * <li><code>explicitWidth</code></li> + * <li><code>explicitHeight</code></li> + * </ul> + * + * <p>When you call the <code>move()</code> method, the <code>move</code> + * event is dispatched before the method returns. + * In all other situations, the <code>move</code> event is not dispatched + * until after the property changes.</p> + * + * <p>This event only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.MoveEvent.MOVE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="move", type="mx.events.MoveEvent")] + +/** + * Dispatched at the beginning of the component initialization sequence. + * The component is in a very raw state when this event is dispatched. + * Many components, such as the Button control, create internal child + * components to implement functionality; for example, the Button control + * creates an internal UITextField component to represent its label text. + * When Flex dispatches the <code>preinitialize</code> event, + * the children, including the internal children, of a component + * have not yet been created. + * + * @eventType mx.events.FlexEvent.PREINITIALIZE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="preinitialize", type="mx.events.FlexEvent")] + +/** + * Dispatched when the component is removed from a container as a content child + * by using the <code>removeChild()</code>, <code>removeChildAt()</code>, + * <code>removeElement()</code>, or <code>removeElementAt()</code> method. + * If the component is removed from the container as a noncontent child by + * using the <code>rawChildren.removeChild()</code> or + * <code>rawChildren.removeChildAt()</code> method, the event is not dispatched. + * + * <p>This event only dispatched when there are one or more relevant listeners + * attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.REMOVE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="remove", type="mx.events.FlexEvent")] + +/** + * Dispatched when the component is resized. + * + * <p>You can resize the component by setting the <code>width</code> or + * <code>height</code> property, by calling the <code>setActualSize()</code> + * method, or by setting one of + * the following properties either on the component or on other components + * such that the LayoutManager needs to change the <code>width</code> or + * <code>height</code> properties of the component:</p> + * + * <ul> + * <li><code>minWidth</code></li> + * <li><code>minHeight</code></li> + * <li><code>maxWidth</code></li> + * <li><code>maxHeight</code></li> + * <li><code>explicitWidth</code></li> + * <li><code>explicitHeight</code></li> + * </ul> + * + * <p>The <code>resize</code> event is not + * dispatched until after the property changes.</p> + * + * <p>This event only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.ResizeEvent.RESIZE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="resize", type="mx.events.ResizeEvent")] + +/** + * Dispatched when an object's state changes from invisible to visible. + * + * <p>This event is only dispatched when there are one or more relevant listeners + * attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.SHOW + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="show", type="mx.events.FlexEvent")] + +//-------------------------------------- +// Mouse events +//-------------------------------------- + +/** + * Dispatched from a component opened using the PopUpManager + * when the user clicks outside it. + * + * @eventType mx.events.FlexMouseEvent.MOUSE_DOWN_OUTSIDE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="mouseDownOutside", type="mx.events.FlexMouseEvent")] + +/** + * Dispatched from a component opened using the PopUpManager + * when the user scrolls the mouse wheel outside it. + * + * @eventType mx.events.FlexMouseEvent.MOUSE_WHEEL_OUTSIDE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="mouseWheelOutside", type="mx.events.FlexMouseEvent")] + +//-------------------------------------- +// Validation events +//-------------------------------------- + +/** + * Dispatched when values are changed programmatically + * or by user interaction. + * + * <p>Because a programmatic change triggers this event, make sure + * that any <code>valueCommit</code> event handler does not change + * a value that causes another <code>valueCommit</code> event. + * For example, do not change a control's <code>dataProvider</code> + * property in a <code>valueCommit</code> event handler. </p> + * + * @eventType mx.events.FlexEvent.VALUE_COMMIT + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="valueCommit", type="mx.events.FlexEvent")] + +/** + * Dispatched when a component is monitored by a Validator + * and the validation failed. + * + * @eventType mx.events.FlexEvent.INVALID + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="invalid", type="mx.events.FlexEvent")] + +/** + * Dispatched when a component is monitored by a Validator + * and the validation succeeded. + * + * @eventType mx.events.FlexEvent.VALID + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="valid", type="mx.events.FlexEvent")] + +//-------------------------------------- +// Drag-and-drop events +//-------------------------------------- + +/** + * Dispatched by a component when the user moves the mouse over the component + * during a drag operation. + * In an application running in Flash Player, + * the event is dispatched many times when you move the mouse over any component. + * In an application running in AIR, the event is dispatched only once. + * + * <p>In order to be a valid drop target, you must define a handler + * for this event. + * In the handler, you can change the appearance of the drop target + * to provide visual feedback to the user that the component can accept + * the drag. + * For example, you could draw a border around the drop target, + * or give focus to the drop target.</p> + * + * <p>If you want to accept the drag, you must call the + * <code>DragManager.acceptDragDrop()</code> method. If you don't + * call <code>acceptDragDrop()</code>, you do not get any of the + * other drag events.</p> + * + * <p>In Flash Player, the value of the <code>action</code> property is always + * <code>DragManager.MOVE</code>, even if you are doing a copy. + * This is because the <code>dragEnter</code> event occurs before + * the control recognizes that the Control key is pressed to signal a copy. + * The <code>action</code> property of the event object for the + * <code>dragOver</code> event does contain a value that signifies the type of + * drag operation. You can change the type of drag action by calling the + * <code>DragManager.showFeedback()</code> method.</p> + * + * <p>In AIR, the default value of the <code>action</code> property is + * <code>DragManager.COPY</code>.</p> + * + * <p>Because of the way data to a Tree control is structured, + * the Tree control handles drag and drop differently from the other list-based controls. + * For the Tree control, the event handler for the <code>dragDrop</code> event + * only performs an action when you move or copy data in the same Tree control, + * or copy data to another Tree control. + * If you drag data from one Tree control and drop it onto another Tree control + * to move the data, the event handler for the <code>dragComplete</code> event + * actually performs the work to add the data to the destination Tree control, + * rather than the event handler for the dragDrop event, + * and also removes the data from the source Tree control. + * This is necessary because to reparent the data being moved, + * Flex must remove it first from the source Tree control.</p> + * + * @see mx.managers.DragManager + * + * @eventType mx.events.DragEvent.DRAG_ENTER + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="dragEnter", type="mx.events.DragEvent")] + +/** + * Dispatched by a component when the user moves the mouse while over the component + * during a drag operation. + * In Flash Player, the event is dispatched + * when you drag an item over a valid drop target. + * In AIR, the event is dispatched when you drag an item over + * any component, even if the component is not a valid drop target. + * + * <p>In the handler, you can change the appearance of the drop target + * to provide visual feedback to the user that the component can accept + * the drag. + * For example, you could draw a border around the drop target, + * or give focus to the drop target.</p> + * + * <p>Handle this event to perform additional logic + * before allowing the drop, such as dropping data to various locations + * in the drop target, reading keyboard input to determine if the + * drag-and-drop action is a move or copy of the drag data, or providing + * different types of visual feedback based on the type of drag-and-drop + * action.</p> + * + * <p>You can also change the type of drag action by changing the + * <code>DragManager.showFeedback()</code> method. + * The default value of the <code>action</code> property is + * <code>DragManager.MOVE</code>.</p> + * + * @see mx.managers.DragManager + * + * @eventType mx.events.DragEvent.DRAG_OVER + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="dragOver", type="mx.events.DragEvent")] + +/** + * Dispatched by the component when the user drags outside the component, + * but does not drop the data onto the target. + * + * <p>You use this event to restore the drop target to its normal appearance + * if you modified its appearance as part of handling the + * <code>dragEnter</code> or <code>dragOver</code> event.</p> + * + * @eventType mx.events.DragEvent.DRAG_EXIT + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="dragExit", type="mx.events.DragEvent")] + +/** + * Dispatched by the drop target when the user releases the mouse over it. + * + * <p>You use this event handler to add the drag data to the drop target.</p> + * + * <p>If you call <code>Event.preventDefault()</code> in the event handler + * for the <code>dragDrop</code> event for + * a Tree control when dragging data from one Tree control to another, + * it prevents the drop.</p> + * + * @eventType mx.events.DragEvent.DRAG_DROP + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="dragDrop", type="mx.events.DragEvent")] + +/** + * Dispatched by the drag initiator (the component that is the source + * of the data being dragged) when the drag operation completes, + * either when you drop the dragged data onto a drop target or when you end + * the drag-and-drop operation without performing a drop. + * + * <p>You can use this event to perform any final cleanup + * of the drag-and-drop operation. + * For example, if you drag a List control item from one list to another, + * you can delete the List control item from the source if you no longer + * need it.</p> + * + * <p>If you call <code>Event.preventDefault()</code> in the event handler + * for the <code>dragComplete</code> event for + * a Tree control when dragging data from one Tree control to another, + * it prevents the drop.</p> + * + * @eventType mx.events.DragEvent.DRAG_COMPLETE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="dragComplete", type="mx.events.DragEvent")] + +/** + * Dispatched by the drag initiator when starting a drag operation. + * This event is used internally by the list-based controls; + * you do not handle it when implementing drag and drop. + * If you want to control the start of a drag-and-drop operation, + * use the <code>mouseDown</code> or <code>mouseMove</code> event. + * + * @eventType mx.events.DragEvent.DRAG_START + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="dragStart", type="mx.events.DragEvent")] + +//-------------------------------------- +// Effect events +//-------------------------------------- + +/** + * Dispatched just before an effect starts. + * + * <p>The effect does not start changing any visuals + * until after this event is fired.</p> + * + * @eventType mx.events.EffectEvent.EFFECT_START + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="effectStart", type="mx.events.EffectEvent")] + +/** + * Dispatched after an effect is stopped, which happens + * only by a call to <code>stop()</code> on the effect. + * + * <p>The effect then dispatches the EFFECT_END event + * as the effect finishes. The purpose of the EFFECT_STOP + * event is to let listeners know that the effect came to + * a premature end, rather than ending naturally or as a + * result of a call to <code>end()</code>.</p> + * + * @eventType mx.events.EffectEvent.EFFECT_STOP + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="effectStop", type="mx.events.EffectEvent")] + +/** + * Dispatched after an effect ends. + * + * <p>The effect makes the last set of visual changes + * before this event is fired, but those changes are not + * rendered on the screen. + * Thus, you might have to use the <code>callLater()</code> method + * to delay any other changes that you want to make until after the + * changes have been rendered onscreen.</p> + * + * @eventType mx.events.EffectEvent.EFFECT_END + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="effectEnd", type="mx.events.EffectEvent")] + + +//-------------------------------------- +// State events +//-------------------------------------- + +/** + * Dispatched after the <code>currentState</code> property changes, + * but before the view state changes. + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.StateChangeEvent.CURRENT_STATE_CHANGING + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="currentStateChanging", type="mx.events.StateChangeEvent")] + +/** + * Dispatched after the view state has changed. + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.StateChangeEvent.CURRENT_STATE_CHANGE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="currentStateChange", type="mx.events.StateChangeEvent")] + +/** + * Dispatched after the component has entered a view state. + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.ENTER_STATE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="enterState", type="mx.events.FlexEvent")] + +/** + * Dispatched just before the component exits a view state. + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.EXIT_STATE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="exitState", type="mx.events.FlexEvent")] + +/** + * Dispatched after the component has entered a new state and + * any state transition animation to that state has finished playing. + * + * The event is dispatched immediately if there's no transition playing + * between the states. + * + * If the component switches to a different state while the transition is + * underway, this event will be dispatched after the component completes the + * transition to that new state. + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.STATE_CHANGE_COMPLETE + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +[Event(name="stateChangeComplete", type="mx.events.FlexEvent")] + +/** + * Dispatched when a component interrupts a transition to its current + * state in order to switch to a new state. + * + * <p>This event is only dispatched when there are one or more + * relevant listeners attached to the dispatching object.</p> + * + * @eventType mx.events.FlexEvent.STATE_CHANGE_INTERRUPTED + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +[Event(name="stateChangeInterrupted", type="mx.events.FlexEvent")] + + +//-------------------------------------- +// TouchInteraction events +//-------------------------------------- + +/** + * A cancellable event, dispatched by a component in an attempt to + * respond to a touch interaction user gesture. + * + * <p>The event is a bubbling event dispatched on the + * DisplayObject that the touch interaction + * started (where the mouseDown/touchBegin occurred).</p> + * + * <p>Components responding to touch interactions should listen for + * touch interaction events to coordinate with other components around + * what type of touch interaction the user intended to make and which component + * is responding to that touch interaction.</p> + * + * <p>A Scroller component will dispatch a touchInteractionStarting event + * to alert other components that may be responding to the same user's + * touch interaction that it would like to take control of this touch interaction. + * This is an opportunity for other components to cancel the Scroller's + * action and to maintain control over this touch interaction.</p> + * + * @eventType mx.events.TouchInteractionEvent.TOUCH_INTERACTION_STARTING + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +[Event(name="touchInteractionStarting", type="mx.events.TouchInteractionEvent")] + +/** + * A non-cancellable event, dispatched by a component when it starts + * responding to a touch interaction user gesture. + * + * <p>The event is a bubbling event dispatched on the + * DisplayObject that the touch interaction + * started (where the mouseDown/touchBegin occurred).</p> + * + * <p>Components responding to touch interactions should listen for + * touch interaction events to coordinate with other components around + * what type of touch interaction the user intended to make and which component + * is responding to that touch interaction.</p> + * + * <p>A Scroller component will dispatch a touchInteractionStart event + * to alert other components that may be responding to the same user's + * touch interaction that it is taking control of this touch interaction. + * When they see this event, other components should stop responding + * to the touch interaction, remove any visual indications that it is + * responding to the touch interaction, and perform other clean up.</p> + * + * @eventType mx.events.TouchInteractionEvent.TOUCH_INTERACTION_START + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +[Event(name="touchInteractionStart", type="mx.events.TouchInteractionEvent")] + +/** + * A non-cancellable event, dispatched by a component when it is done + * responding to a touch interaction user gesture. + * + * <p>The event is a bubbling event dispatched on the + * DisplayObject that the touch interaction + * started (where the mouseDown/touchBegin occurred).</p> + * + * <p>Components responding to touch interactions should listen for + * touch interaction events to coordinate with other components around + * what type of touch interaction the user intended to make and which component + * is responding to that touch interaction.</p> + * + * <p>A Scroller component will dispatch a touchInteractionEnd event + * to alert other components that it is done responding to the user's + * touch interaction.</p> + * + * @eventType mx.events.TouchInteractionEvent.TOUCH_INTERACTION_END + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +[Event(name="touchInteractionEnd", type="mx.events.TouchInteractionEvent")] + +//-------------------------------------- +// Tooltip events +//-------------------------------------- + +/** + * Dispatched by the component when it is time to create a ToolTip. + * + * <p>If you create your own IToolTip object and place a reference + * to it in the <code>toolTip</code> property of the event object + * that is passed to your <code>toolTipCreate</code> handler, + * the ToolTipManager displays your custom ToolTip. + * Otherwise, the ToolTipManager creates an instance of + * <code>ToolTipManager.toolTipClass</code> to display.</p> + * + * <p>The sequence of ToolTip events is <code>toolTipStart</code>, + * <code>toolTipCreate</code>, <code>toolTipShow</code>, + * <code>toolTipShown</code>, <code>toolTipHide</code>, + * and <code>toolTipEnd</code>.</p> + * + * @eventType mx.events.ToolTipEvent.TOOL_TIP_CREATE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="toolTipCreate", type="mx.events.ToolTipEvent")] + +/** + * Dispatched by the component when its ToolTip has been hidden + * and is to be discarded soon. + * + * <p>If you specify an effect using the + * <code>ToolTipManager.hideEffect</code> property, + * this event is dispatched after the effect stops playing.</p> + * + * <p>The sequence of ToolTip events is <code>toolTipStart</code>, + * <code>toolTipCreate</code>, <code>toolTipShow</code>, + * <code>toolTipShown</code>, <code>toolTipHide</code>, + * and <code>toolTipEnd</code>.</p> + * + * @eventType mx.events.ToolTipEvent.TOOL_TIP_END + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="toolTipEnd", type="mx.events.ToolTipEvent")] + +/** + * Dispatched by the component when its ToolTip is about to be hidden. + * + * <p>If you specify an effect using the + * <code>ToolTipManager.hideEffect</code> property, + * this event is dispatched before the effect starts playing.</p> + * + * <p>The sequence of ToolTip events is <code>toolTipStart</code>, + * <code>toolTipCreate</code>, <code>toolTipShow</code>, + * <code>toolTipShown</code>, <code>toolTipHide</code>, + * and <code>toolTipEnd</code>.</p> + * + * @eventType mx.events.ToolTipEvent.TOOL_TIP_HIDE + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="toolTipHide", type="mx.events.ToolTipEvent")] + +/** + * Dispatched by the component when its ToolTip is about to be shown. + * + * <p>If you specify an effect using the + * <code>ToolTipManager.showEffect</code> property, + * this event is dispatched before the effect starts playing. + * You can use this event to modify the ToolTip before it appears.</p> + * + * <p>The sequence of ToolTip events is <code>toolTipStart</code>, + * <code>toolTipCreate</code>, <code>toolTipShow</code>, + * <code>toolTipShown</code>, <code>toolTipHide</code>, + * and <code>toolTipEnd</code>.</p> + * + * @eventType mx.events.ToolTipEvent.TOOL_TIP_SHOW + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="toolTipShow", type="mx.events.ToolTipEvent")] + +/** + * Dispatched by the component when its ToolTip has been shown. + * + * <p>If you specify an effect using the + * <code>ToolTipManager.showEffect</code> property, + * this event is dispatched after the effect stops playing.</p> + * + * <p>The sequence of ToolTip events is <code>toolTipStart</code>, + * <code>toolTipCreate</code>, <code>toolTipShow</code>, + * <code>toolTipShown</code>, <code>toolTipHide</code>, + * and <code>toolTipEnd</code>.</p> + * + * @eventType mx.events.ToolTipEvent.TOOL_TIP_SHOWN + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="toolTipShown", type="mx.events.ToolTipEvent")] + +/** + * Dispatched by a component whose <code>toolTip</code> property is set, + * as soon as the user moves the mouse over it. + * + * <p>The sequence of ToolTip events is <code>toolTipStart</code>, + * <code>toolTipCreate</code>, <code>toolTipShow</code>, + * <code>toolTipShown</code>, <code>toolTipHide</code>, + * and <code>toolTipEnd</code>.</p> + * + * @eventType mx.events.ToolTipEvent.TOOL_TIP_START + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Event(name="toolTipStart", type="mx.events.ToolTipEvent")] + +//-------------------------------------- +// Styles +//-------------------------------------- + +include "../styles/metadata/AnchorStyles.as"; + +/** + * The main color for a component. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4 + */ +[Style(name="chromeColor", type="uint", format="Color", inherit="yes", theme="spark")] + +/** + * Color of the component highlight when validation fails. + * Flex also sets the <code>borderColor</code> style of the component to this + * <code>errorColor</code> on a validation failure. + * + * The default value for the Halo theme is <code>0xFF0000</code>. + * The default value for the Spark theme is <code>0xFE0000</code>. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Style(name="errorColor", type="uint", format="Color", inherit="yes")] + +/** + * The primary interaction mode for this component. The acceptable values are: + * <code>mouse</code> and <code>touch</code>. + * + * The default value for the Halo theme is <code>mouse</code>. + * The default value for the Spark theme is <code>mouse</code>. + * The default value for the Mobile theme is <code>touch</code>. + * + * @see mx.core.InteractionMode#MOUSE + * @see mx.core.InteractionMode#TOUCH + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +[Style(name="interactionMode", type="String", enumeration="mouse,touch", inherit="yes")] + +/** + * Blend mode used by the focus rectangle. + * For more information, see the <code>blendMode</code> property + * of the flash.display.DisplayObject class. + * + * @default "normal" + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Style(name="focusBlendMode", type="String", inherit="no")] + +/** + * Skin used to draw the focus rectangle. + * + * The default value for Halo components is mx.skins.halo.HaloFocusRect. + * The default value for Spark components is spark.skins.spark.FocusSkin. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Style(name="focusSkin", type="Class", inherit="no")] + +/** + * Thickness, in pixels, of the focus rectangle outline. + * + * @default 2 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Style(name="focusThickness", type="Number", format="Length", inherit="no", minValue="0.0")] + +/** + * Specifies the desired layout direction of a component. The allowed values + * are <code>"ltr"</code> for left-to-right layout, used for + * components using Latin-style scripts, and <code>"rtl"</code> for + * right-to-left layout, used for components using scripts such + * as Arabic and Hebrew. + * + * <p>In ActionScript you can set the layoutDirection using the values + * <code>mx.core.LayoutDirection.LTR</code>, + * <code>mx.core.LayoutDirection.RTL</code> or + * <code>undefined</code>, to inherit the layoutDirection from the parent.</p> + * + * <p>The layoutDirection should typically be set on the + * <code>Application</code> rather than on individual components. If the + * layoutDirection is <code>"rtl"</code>, most visual elements, except text + * and images, will be mirrored. The directionality of text is determined + * by the <code>direction</code> style.</p> + * + * <p>Components which handle Keyboard.LEFT and Keyboard.RIGHT events + * typically swap the keyâs meaning when layoutDirection is + * <code>ârtlâ</code>. In other words, left always means move left and + * right always means move right, regardless of the + * <code>layoutDirection</code></p> + * + * <p>Note: This style applies to all Spark components and MX components that + * specify UIFTETextField as their textFieldClass.</p> + * + * @default "ltr" + * + * @see MXFTEText.css + * @see mx.core.ILayoutDirectionElement + * @see mx.core.LayoutDirection + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4.1 + */ +[Style(name="layoutDirection", type="String", enumeration="ltr,rtl", inherit="yes")] + +/** + * Show the error border or skin when this component is invalid + * + * @default true + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4.5 + */ +[Style(name="showErrorSkin", type="Boolean", inherit="yes")] + +/** + * Show the error tip when this component is invalid and the user + * rolls over it + * + * @default true + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 4.5 + */ +[Style(name="showErrorTip", type="Boolean", inherit="yes")] + +/** + * Theme color of a component. This property controls the appearance of highlights, + * appearance when a component is selected, and other similar visual cues, but it + * does not have any effect on the regular borders or background colors of the component. + * The preferred values are <code>haloGreen</code>, <code>haloBlue</code>, + * <code>haloOrange</code>, and <code>haloSilver</code>, although any valid color + * value can be used. + * + * <p>The default values of the <code>rollOverColor</code> and + * <code>selectionColor</code> styles are based on the + * <code>themeColor</code> value.</p> + * + * @default "haloBlue" + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Style(name="themeColor", type="uint", format="Color", inherit="yes", theme="halo")] + +//-------------------------------------- +// Effects +//-------------------------------------- + +/** + * Played when the component is created. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="creationCompleteEffect", event="creationComplete")] + +/** + * Played when the component is moved. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="moveEffect", event="move")] + +/** + * Played when the component is resized. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="resizeEffect", event="resize")] + +/** + * Played when the component becomes visible. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="showEffect", event="show")] + +/** + * Played when the component becomes invisible. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="hideEffect", event="hide")] + +/** + * Played when the user presses the mouse button while over the component. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="mouseDownEffect", event="mouseDown")] + +/** + * Played when the user releases the mouse button while over the component. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="mouseUpEffect", event="mouseUp")] + +/** + * Played when the user rolls the mouse over the component. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="rollOverEffect", event="rollOver")] + +/** + * Played when the user rolls the mouse so it is no longer over the component. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="rollOutEffect", event="rollOut")] + +/** + * Played when the component gains keyboard focus. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="focusInEffect", event="focusIn")] + +/** + * Played when the component loses keyboard focus. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="focusOutEffect", event="focusOut")] + +/** + * Played when the component is added as a child to a Container. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="addedEffect", event="added")] + +/** + * Played when the component is removed from a Container. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +[Effect(name="removedEffect", event="removed")] + +//-------------------------------------- +// Other metadata +//-------------------------------------- + +[AccessibilityClass(implementation="mx.accessibility.UIComponentAccProps")] + +[ResourceBundle("core")] + +// skins resources aren't found because CSS visited by the compiler +[ResourceBundle("skins")] + +/** + * The UIComponent class is the base class for all visual components, + * both interactive and noninteractive. + * + * <p>An interactive component can participate in tabbing and other kinds of + * keyboard focus manipulation, accept low-level events like keyboard and + * mouse input, and be disabled so that it does not receive keyboard and + * mouse input. + * This is in contrast to noninteractive components, like Label and + * ProgressBar, which simply display contents and are not manipulated by + * the user.</p> + * <p>The UIComponent class is not used as an MXML tag, but is used as a base + * class for other classes.</p> + * + * @mxml + * + * <p>All user interface components in Flex extend the UIComponent class. + * Flex components inherit the following properties from the UIComponent + * class:</p> + * + * <pre> + * <mx:<i>tagname</i> + * <b>Properties </b> + * accessibilityDescription="null" + * accessibilityName="null" + * accessibilityShortcut="null" + * accessibilitySilent="true|false" + * automationName="null" + * cachePolicy="auto|on|off" + * currentState="null" + * doubleClickEnabled="false|true" + * enabled="true|false" + * explicitHeight="NaN" + * explicitMaxHeight="NaN" + * explicitMaxWidth="NaN" + * explicitMinHeight="NaN" + * explicitMinWidth="NaN" + * explicitWidth="NaN" + * focusEnabled="true|false" + * hasFocusableChildren="false|true" + * height="0" + * id="" + * includeInLayout="true|false" + * maxHeight="10000" + * maxWidth="10000" + * measuredHeight= + * measuredMinHeight= + * measuredMinWidth= + * measuredWidth= + * minHeight="0" + * minWidth="0" + * mouseFocusEnabled="true|false" + * percentHeight="NaN" + * percentWidth="NaN" + * scaleX="1.0" + * scaleY="1.0" + * states="null" + * styleName="undefined" + * toolTip="null" + * transitions="" + * validationSubField + * width="0" + * x="0" + * y="0" + * + * <b>Styles</b> + * bottom="undefined" + * errorColor="0xFF0000" + * focusBlendMode="normal" + * focusSkin="HaloFocusRect"" + * focusThickness="2" + * horizontalCenter="undefined" + * layoutDirection="ltr" + * left="undefined" + * right="undefined" + * themeColor="haloGreen" + * top="undefined" + * verticalCenter="undefined" + * + * <b>Effects</b> + * addedEffect="<i>No default</i>" + * creationCompleteEffect="<i>No default</i>" + * focusInEffect="<i>No default</i>" + * focusOutEffect="<i>No default</i>" + * hideEffect="<i>No default</i>" + * mouseDownEffect="<i>No default</i>" + * mouseUpEffect="<i>No default</i>" + * moveEffect="<i>No default</i>" + * removedEffect="<i>No default</i>" + * resizeEffect="<i>No default</i>" + * rollOutEffect="<i>No default</i>" + * rollOverEffect="<i>No default</i>" + * showEffect="<i>No default</i>" + * + * <b>Events</b> + * add="<i>No default</i>" + * creationComplete="<i>No default</i>" + * currentStateChange="<i>No default</i>" + * currentStateChanging="<i>No default</i>" + * dragComplete="<i>No default</i>" + * dragDrop="<i>No default</i>" + * dragEnter="<i>No default</i>" + * dragExit="<i>No default</i>" + * dragOver="<i>No default</i>" + * effectEnd="<i>No default</i>" + * effectStart="<i>No default</i>" + * enterState="<i>No default</i>" + * exitState="<i>No default</i>" + * hide="<i>No default</i>" + * initialize="<i>No default</i>" + * invalid="<i>No default</i>" + * mouseDownOutside="<i>No default</i>" + * mouseWheelOutside="<i>No default</i>" + * move="<i>No default</i>" + * preinitialize="<i>No default</i>" + * remove="<i>No default</i>" + * resize="<i>No default</i>" + * show="<i>No default</i>" + * toolTipCreate="<i>No default</i>" + * toolTipEnd="<i>No default</i>" + * toolTipHide="<i>No default</i>" + * toolTipShow="<i>No default</i>" + * toolTipShown="<i>No default</i>" + * toolTipStart="<i>No default</i>" + * updateComplete="<i>No default</i>" + * valid="<i>No default</i>" + * valueCommit="<i>No default</i>" + * > + * </pre> + * + * @see mx.core.UIComponent + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +public class UIComponent extends Sprite + implements IAutomationObject, IChildList, IConstraintClient, + IDeferredInstantiationUIComponent, IFlexDisplayObject, IFlexModule, + IInvalidating, ILayoutManagerClient, IPropertyChangeNotifier, + IRepeaterClient, IStateClient, IAdvancedStyleClient, IToolTipManagerClient, + IUIComponent, IValidatorListener, IVisualElement +{ + include "../core/Version.as"; + + //-------------------------------------------------------------------------- + // + // Class constants + // + //-------------------------------------------------------------------------- + + /** + * The default value for the <code>measuredWidth</code> property. + * Most components calculate a measuredWidth but some are flow-based and + * have to pick a number that looks reasonable. + * + * @default 160 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DEFAULT_MEASURED_WIDTH:Number = 160; + + /** + * The default value for the <code>measuredMinWidth</code> property. + * Most components calculate a measuredMinWidth but some are flow-based and + * have to pick a number that looks reasonable. + * + * @default 40 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DEFAULT_MEASURED_MIN_WIDTH:Number = 40; + + /** + * The default value for the <code>measuredHeight</code> property. + * Most components calculate a measuredHeight but some are flow-based and + * have to pick a number that looks reasonable. + * + * @default 22 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DEFAULT_MEASURED_HEIGHT:Number = 22; + + /** + * The default value for the <code>measuredMinHeight</code> property. + * Most components calculate a measuredMinHeight but some are flow-based and + * have to pick a number that looks reasonable. + * + * @default 22 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DEFAULT_MEASURED_MIN_HEIGHT:Number = 22; + + /** + * The default value for the <code>maxWidth</code> property. + * + * @default 10000 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DEFAULT_MAX_WIDTH:Number = 10000; + // When changing this constant, make sure you change + // the constant with the same name in LayoutElementUIComponentUtils + + /** + * The default value for the <code>maxHeight</code> property. + * + * @default 10000 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DEFAULT_MAX_HEIGHT:Number = 10000; + // When changing this constant, make sure you change + // the constant with the same name in LayoutElementUIComponentUtils + + /** + * @private + * Static constant representing no cached layout direction style value. + */ + private static const LAYOUT_DIRECTION_CACHE_UNSET:String = "layoutDirectionCacheUnset"; + + + //-------------------------------------------------------------------------- + // + // Class mixins + // + //-------------------------------------------------------------------------- + + /** + * @private + * Placeholder for mixin by UIComponentAccProps. + */ + mx_internal static var createAccessibilityImplementation:Function; + + //-------------------------------------------------------------------------- + // + // Class properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // embeddedFontRegistry + //---------------------------------- + + private static var noEmbeddedFonts:Boolean; + + /** + * @private + * Storage for the _embeddedFontRegistry property. + * Note: This gets initialized on first access, + * not when this class is initialized, in order to ensure + * that the Singleton registry has already been initialized. + */ + private static var _embeddedFontRegistry:IEmbeddedFontRegistry; + + /** + * @private + * A reference to the embedded font registry. + * Single registry in the system. + * Used to look up the moduleFactory of a font. + */ + mx_internal static function get embeddedFontRegistry():IEmbeddedFontRegistry + { + if (!_embeddedFontRegistry && !noEmbeddedFonts) + { + try + { + _embeddedFontRegistry = IEmbeddedFontRegistry( + Singleton.getInstance("mx.core::IEmbeddedFontRegistry")); + } + catch (e:Error) + { + noEmbeddedFonts = true; + } + } + + return _embeddedFontRegistry; + } + + //-------------------------------------------------------------------------- + // + // Class methods + // + //-------------------------------------------------------------------------- + + /** + * Blocks the background processing of methods + * queued by <code>callLater()</code>, + * until <code>resumeBackgroundProcessing()</code> is called. + * + * <p>These methods can be useful when you have time-critical code + * which needs to execute without interruption. + * For example, when you set the <code>suspendBackgroundProcessing</code> + * property of an Effect to <code>true</code>, + * <code>suspendBackgroundProcessing()</code> is automatically called + * when it starts playing, and <code>resumeBackgroundProcessing</code> + * is called when it stops, in order to ensure that the animation + * is smooth.</p> + * + * <p>Since the LayoutManager uses <code>callLater()</code>, + * this means that <code>commitProperties()</code>, + * <code>measure()</code>, and <code>updateDisplayList()</code> + * is not called in between calls to + * <code>suspendBackgroundProcessing()</code> and + * <code>resumeBackgroundProcessing()</code>.</p> + * + * <p>It is safe for both an outer method and an inner method + * (i.e., one that the outer methods calls) to call + * <code>suspendBackgroundProcessing()</code> + * and <code>resumeBackgroundProcessing()</code>, because these + * methods actually increment and decrement a counter + * which determines whether background processing occurs.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static function suspendBackgroundProcessing():void + { + UIComponentGlobals.callLaterSuspendCount++; + } + + /** + * Resumes the background processing of methods + * queued by <code>callLater()</code>, after a call to + * <code>suspendBackgroundProcessing()</code>. + * + * <p>Refer to the description of + * <code>suspendBackgroundProcessing()</code> for more information.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static function resumeBackgroundProcessing():void + { + if (UIComponentGlobals.callLaterSuspendCount > 0) + { + UIComponentGlobals.callLaterSuspendCount--; + + // Once the suspend count gets back to 0, we need to + // force a render event to happen + if (UIComponentGlobals.callLaterSuspendCount == 0) + { + var sm:ISystemManager = SystemManagerGlobals.topLevelSystemManagers[0]; - COMPILE::AS3 ++ COMPILE::SWF + { + if (sm && sm.topOfDisplayList) + sm.topOfDisplayList.invalidate(); + } + } + } + } + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function UIComponent() + { + super(); + + // Override variables in superclasses. - COMPILE::AS3 ++ COMPILE::SWF + { + focusRect = false; // We do our own focus drawing. + // We are tab enabled by default if IFocusManagerComponent + tabEnabled = (this is IFocusManagerComponent); + } + tabFocusEnabled = (this is IFocusManagerComponent); + + // Whether the component can accept user interaction. + // The default is true. If you set enabled to false for a container, + // Flex dims the color of the container and of all of its children, + // and blocks user input to the container and to all of its children. + // We set enabled to true here because some components keep their + // own _enabled flag and may not initialize it to true. + enabled = true; + + // Make the component invisible until the initialization sequence + // is complete. + // It will be set visible when the 'initialized' flag is set. + $visible = false; + + addEventListener(flex.events.Event.ADDED, addedHandler); + addEventListener(flex.events.Event.REMOVED, removedHandler); + addEventListener(flex.events.Event.REMOVED_FROM_STAGE, removedFromStageHandler); + + // Register for focus and keyboard events. + if (this is IFocusManagerComponent) + { + addEventListener(FocusEvent.FOCUS_IN, focusInHandler); + addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); + addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); + addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); + } + + resourcesChanged(); + + // Register as a weak listener for "change" events from ResourceManager. + // If UIComponents registered as a strong listener, + // they wouldn't get garbage collected. + COMPILE::LATER + { + resourceManager.addEventListener( + org.apache.flex.events.Event.CHANGE, resourceManager_changeHandler, false, 0, true); + } + resourceManager.addEventListener( + org.apache.flex.events.Event.CHANGE, resourceManager_changeHandler); + + _width = super.width; + _height = super.height; + + } + + //-------------------------------------------------------------------------- + // + // Variables + // + //-------------------------------------------------------------------------- + + /** + * @private + * Temporarily stores the values of styles specified with setStyle() until + * moduleFactory is set. + */ + private var deferredSetStyles:Object; + + /** + * @private + * There is a bug (139381) where we occasionally get callLaterDispatcher() + * even though we didn't expect it. + * That causes us to do a removeEventListener() twice, + * which messes up some internal thing in the player so that + * the next addEventListener() doesn't actually get us the render event. + */ + private var listeningForRender:Boolean = false; + + /** + * @private + * List of methods used by callLater(). + */ + private var methodQueue:Array /* of MethodQueueElement */ = []; + + /** + * @private + * Whether or not we "own" the focus graphic + */ + private var hasFocusRect:Boolean = false; + + /** + * @private + * These variables cache the transition state from/to information for + * the transition currently running. This information is used when + * determining what to do with a new transition that interrupts the + * running transition. + */ + private var transitionFromState:String; + private var transitionToState:String; + + /** + * @private + */ + private var parentChangedFlag:Boolean = false; + + /** + * @private + * Cached layout direction style + */ + private var layoutDirectionCachedValue:String = LAYOUT_DIRECTION_CACHE_UNSET; + + /** + * @private + * Whether or not we've processed the MXMLDescriptors + */ + mx_internal var processedMXMLDescriptors:Boolean = false; + + //-------------------------------------------------------------------------- + // + // Variables: Event Priority + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // bindingEventDispatcher + //---------------------------------- + + /** + * @private + * Storage for the binding event dispatcher. + */ + private var _bindingEventDispatcher:EventDispatcher; + + [Inspectable(environment="none")] + + /** + * Events get dispatched here first + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get bindingEventDispatcher():IEventDispatcher + { + if (_bindingEventDispatcher == null) + _bindingEventDispatcher = new EventDispatcher(); + return _bindingEventDispatcher; + } + + //---------------------------------- + // effectEventDispatcher + //---------------------------------- + + /** + * @private + * Storage for the effect event dispatcher. + */ + private var _effectEventDispatcher:EventDispatcher; + + [Inspectable(environment="none")] + + /** + * Events get dispatched here last + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get effectEventDispatcher():IEventDispatcher + { + if (_effectEventDispatcher == null) + _effectEventDispatcher = new EventDispatcher(); + return _effectEventDispatcher; + } + + //-------------------------------------------------------------------------- + // + // Variables: Creation + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // initialized + //---------------------------------- + + /** + * @private + * Storage for the initialized property. + */ + private var _initialized:Boolean = false; + + [Inspectable(environment="none")] + + /** + * A flag that determines if an object has been through all three phases + * of layout: commitment, measurement, and layout (provided that any were required). + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get initialized():Boolean + { + return _initialized; + } + + /** + * @private + */ + public function set initialized(value:Boolean):void + { + _initialized = value; + + if (value) + { + setVisible(_visible, true); + dispatchEvent(new FlexEvent(FlexEvent.CREATION_COMPLETE)); + } + } + + //---------------------------------- + // processedDescriptors + //---------------------------------- + + /** + * @private + * Storage for the processedDescriptors property. + */ + private var _processedDescriptors:Boolean = false; + + [Inspectable(environment="none")] + + /** + * Set to <code>true</code> after immediate or deferred child creation, + * depending on which one happens. For a Container object, it is set + * to <code>true</code> at the end of + * the <code>createComponentsFromDescriptors()</code> method, + * meaning after the Container object creates its children from its child descriptors. + * + * <p>For example, if an Accordion container uses deferred instantiation, + * the <code>processedDescriptors</code> property for the second pane of + * the Accordion container does not become <code>true</code> until after + * the user navigates to that pane and the pane creates its children. + * But, if the Accordion had set the <code>creationPolicy</code> property + * to <code>"all"</code>, the <code>processedDescriptors</code> property + * for its second pane is set to <code>true</code> during application startup.</p> + * + * <p>For classes that are not containers, which do not have descriptors, + * it is set to <code>true</code> after the <code>createChildren()</code> + * method creates any internal component children.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get processedDescriptors():Boolean + { + return _processedDescriptors; + } + + /** + * @private + */ + public function set processedDescriptors(value:Boolean):void + { + _processedDescriptors = value; + + if (value) + dispatchEvent(new FlexEvent(FlexEvent.INITIALIZE)); + } + + //---------------------------------- + // updateCompletePendingFlag + //---------------------------------- + + /** + * @private + * Storage for the updateCompletePendingFlag property. + */ + private var _updateCompletePendingFlag:Boolean = false; + + [Inspectable(environment="none")] + + /** + * A flag that determines if an object has been through all three phases + * of layout validation (provided that any were required). + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get updateCompletePendingFlag():Boolean + { + return _updateCompletePendingFlag; + } + + /** + * @private + */ + public function set updateCompletePendingFlag(value:Boolean):void + { + _updateCompletePendingFlag = value; + } + + //------------------------------------------------------------------------ + // + // Properties: Accessibility + // + //------------------------------------------------------------------------ + + /** + * A convenience accessor for the <code>silent</code> property + * in this UIComponent's <code>accessibilityProperties</code> object. + * + * <p>Note that <code>accessibilityEnabled</code> has the opposite sense from silent; + * <code>accessibilityEnabled</code> is <code>true</code> + * when <code>silent</code> is <code>false</code>.</p> + * + * <p>The getter simply returns <code>accessibilityProperties.silent</code>, + * or <code>true</code> if <code>accessibilityProperties</code> is null. + * The setter first checks whether <code>accessibilityProperties</code> is null, + * and if it is, sets it to a new AccessibilityProperties instance. + * Then it sets <code>accessibilityProperties.silent</code>.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + COMPILE::LATER + public function get accessibilityEnabled():Boolean + { + return accessibilityProperties ? !accessibilityProperties.silent : true; + } + + COMPILE::LATER + public function set accessibilityEnabled(value:Boolean):void + { + if (!Capabilities.hasAccessibility) + return; + + if (!accessibilityProperties) + accessibilityProperties = new AccessibilityProperties(); + + accessibilityProperties.silent = !value; + Accessibility.updateProperties(); + } + + /** + * A convenience accessor for the <code>name</code> property + * in this UIComponent's <code>accessibilityProperties</code> object. + * + * <p>The getter simply returns <code>accessibilityProperties.name</code>, + * or "" if accessibilityProperties is null. + * The setter first checks whether <code>accessibilityProperties</code> is null, + * and if it is, sets it to a new AccessibilityProperties instance. + * Then it sets <code>accessibilityProperties.name</code>.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + COMPILE::LATER + public function get accessibilityName():String + { + return accessibilityProperties ? accessibilityProperties.name : ""; + } + + COMPILE::LATER + public function set accessibilityName(value:String):void + { + if (!Capabilities.hasAccessibility) + return; + + if (!accessibilityProperties) + accessibilityProperties = new AccessibilityProperties(); + + accessibilityProperties.name = value; + Accessibility.updateProperties(); + } + + /** + * A convenience accessor for the <code>description</code> property + * in this UIComponent's <code>accessibilityProperties</code> object. + * + * <p>The getter simply returns <code>accessibilityProperties.description</code>, + * or "" if <code>accessibilityProperties</code> is null. + * The setter first checks whether <code>accessibilityProperties</code> is null, + * and if it is, sets it to a new AccessibilityProperties instance. + * Then it sets <code>accessibilityProperties.description</code>.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + COMPILE::LATER + public function get accessibilityDescription():String + { + return accessibilityProperties ? accessibilityProperties.description : ""; + } + + COMPILE::LATER + public function set accessibilityDescription(value:String):void + { + if (!Capabilities.hasAccessibility) + return; + + if (!accessibilityProperties) + accessibilityProperties = new AccessibilityProperties(); + + accessibilityProperties.description = value; + Accessibility.updateProperties(); + } + + /** + * A convenience accessor for the <code>shortcut</code> property + * in this UIComponent's <code>accessibilityProperties</code> object. + * + * <p>The getter simply returns <code>accessibilityProperties.shortcut</code>, + * or "" if <code>accessibilityProperties</code> is null. + * The setter first checks whether <code>accessibilityProperties</code> is null, + * and if it is, sets it to a new AccessibilityProperties instance. + * Then it sets <code>accessibilityProperties.shortcut</code>.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + COMPILE::LATER + public function get accessibilityShortcut():String + { + return accessibilityProperties ? accessibilityProperties.shortcut : ""; + } + + COMPILE::LATER + public function set accessibilityShortcut(value:String):void + { + if (!Capabilities.hasAccessibility) + return; + + if (!accessibilityProperties) + accessibilityProperties = new AccessibilityProperties(); + + accessibilityProperties.shortcut = value; + Accessibility.updateProperties(); + } + + //-------------------------------------------------------------------------- + // + // Variables: Invalidation + // + //-------------------------------------------------------------------------- + + /** + * @private + * Whether this component needs to have its + * commitProperties() method called. + */ + mx_internal var invalidatePropertiesFlag:Boolean = false; + + /** + * @private + * Whether this component needs to have its + * measure() method called. + */ + mx_internal var invalidateSizeFlag:Boolean = false; + + /** + * @private + * Whether this component needs to be have its + * updateDisplayList() method called. + */ + mx_internal var invalidateDisplayListFlag:Boolean = false; + + /** + * @private + * Whether setActualSize() has been called on this component + * at least once. This is used in validateBaselinePosition() + * to resize the component to explicit or measured + * size if baselinePosition getter is called before the + * component has been resized by the layout. + */ + mx_internal var setActualSizeCalled:Boolean = false; + + //-------------------------------------------------------------------------- + // + // Variables: Measurement + // + //-------------------------------------------------------------------------- + + /** + * @private + * Holds the last recorded value of the x property. + * Used in dispatching a MoveEvent. + */ + private var oldX:Number = 0; + + /** + * @private + * Holds the last recorded value of the y property. + * Used in dispatching a MoveEvent. + */ + private var oldY:Number = 0; + + /** + * @private + * Holds the last recorded value of the width property. + * Used in dispatching a ResizeEvent. + */ + private var oldWidth:Number = 0; + + /** + * @private + * Holds the last recorded value of the height property. + * Used in dispatching a ResizeEvent. + */ + private var oldHeight:Number = 0; + + /** + * @private + * Holds the last recorded value of the minWidth property. + */ + private var oldMinWidth:Number; + + /** + * @private + * Holds the last recorded value of the minHeight property. + */ + private var oldMinHeight:Number; + + /** + * @private + * Holds the last recorded value of the explicitWidth property. + */ + private var oldExplicitWidth:Number; + + /** + * @private + * Holds the last recorded value of the explicitHeight property. + */ + private var oldExplicitHeight:Number; + + /** + * @private + * Holds the last recorded value of the scaleX property. + */ + private var oldScaleX:Number = 1.0; + + /** + * @private + * Holds the last recorded value of the scaleY property. + */ + private var oldScaleY:Number = 1.0; + + /** + * @private + * True if createInFontContext has been called. + */ + private var hasFontContextBeenSaved:Boolean = false; + + /** + * @private + * Holds the last recorded value of the module factory used to create the font. + */ + private var oldEmbeddedFontContext:IFlexModuleFactory = null; + + /** + * @private + * + * storage for advanced layout and transform properties. + */ + COMPILE::LATER + mx_internal var _layoutFeatures:AdvancedLayoutFeatures; + mx_internal var _layoutFeatures:Object; + + /** + * @private + * + * storage for the modified Transform object that can dispatch change events correctly. + */ + COMPILE::LATER + private var _transform:flash.geom.Transform; + //-------------------------------------------------------------------------- + // + // Variables: Styles + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private var cachedTextFormat:UITextFormat; + + //-------------------------------------------------------------------------- + // + // Variables: Effects + // + //-------------------------------------------------------------------------- + + /** + * @private + * Sprite used to display an overlay. + */ + mx_internal var effectOverlay:UIComponent; + + /** + * @private + * Color used for overlay. + */ + mx_internal var effectOverlayColor:uint; + + /** + * @private + * Counter to keep track of the number of current users + * of the overlay. + */ + mx_internal var effectOverlayReferenceCount:int = 0; + + //-------------------------------------------------------------------------- + // + // Variables: Validation + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + mx_internal var saveBorderColor:Boolean = true; + + /** + * @private + */ + mx_internal var origBorderColor:Number; + + //-------------------------------------------------------------------------- + // + // Variables: Other + // + //-------------------------------------------------------------------------- + + /** + * @private + * Storage for automatically-created RadioButtonGroups. + * If a RadioButton's groupName isn't the id of a RadioButtonGroup tag, + * we automatically create a RadioButtonGroup and store it here as + * document.automaticRadioButtonGroups[groupName] = theRadioButtonGroup; + */ + mx_internal var automaticRadioButtonGroups:Object; + + private var _usingBridge:int = -1; + + /** + * @private + */ + private function get usingBridge():Boolean + { + if (_usingBridge == 0) return false; + if (_usingBridge == 1) return true; + + if (!_systemManager) return false; + + // no types so no dependencies + var mp:Object = _systemManager.getImplementation("mx.managers::IMarshalSystemManager"); + if (!mp) + { + _usingBridge = 0; + return false; + } + if (mp.useSWFBridge()) + { + _usingBridge = 1; + return true; + } + _usingBridge = 0; + return false; + } + + //-------------------------------------------------------------------------- + // + // Overridden properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // owner + //---------------------------------- + + /** + * @private + */ + mx_internal var _owner:DisplayObjectContainer; + + /** + * @copy mx.core.IVisualElement#owner + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get owner():DisplayObjectContainer + { + return _owner ? _owner : parent; + } + + public function set owner(value:DisplayObjectContainer):void + { + _owner = value; + } + + //---------------------------------- + // parent + //---------------------------------- + + /** + * @private + * Reference to this component's virtual parent container. + * "Virtual" means that this parent may not be the same + * as the one that the Player returns as the 'parent' + * property of a DisplayObject. + * For example, if a Container has created a contentPane + * to improve scrolling performance, + * then its "children" are really its grandchildren + * and their "parent" is actually their grandparent, + * because we don't want developers to be concerned with + * whether a contentPane exists or not. + */ + mx_internal var _parent:DisplayObjectContainer; + + /** + * @copy mx.core.IVisualElement#parent + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + override public function get parent():DisplayObjectContainer + { + // Flash PlaceObject tags can have super.parent set + // before we get to setting the _parent property. + try + { + return _parent ? _parent : super.parent; + } + catch (e:Error) + { + // trace("UIComponent.get parent(): " + e); - COMPILE::AS3 ++ COMPILE::SWF + { + if (!(e is SecurityError)) + throw e; + } + } + + return null; + } + + //---------------------------------- + // x + //---------------------------------- + + [Bindable("xChanged")] + [Inspectable(category="General")] + + /** + * Number that specifies the component's horizontal position, + * in pixels, within its parent container. + * + * <p>Setting this property directly or calling <code>move()</code> + * has no effect -- or only a temporary effect -- if the + * component is parented by a layout container such as HBox, Grid, + * or Form, because the layout calculations of those containers + * set the <code>x</code> position to the results of the calculation. + * However, the <code>x</code> property must almost always be set + * when the parent is a Canvas or other absolute-positioning + * container because the default value is 0.</p> + * + * @default 0 + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + override public function get x():Number + { + return (_layoutFeatures == null) ? super.x : _layoutFeatures.layoutX; + } + + /** + * @private + */ + override public function set x(value:Number):void + { + if (x == value) + return; + + if (_layoutFeatures == null) + { + super.x = value; + } + else + { + _layoutFeatures.layoutX = value; + invalidateTransform(); + } + + invalidateProperties(); + + if (parent && parent is UIComponent) + UIComponent(parent).childXYChanged(); + + if (hasEventListener("xChanged")) + dispatchEvent(new flex.events.Event("xChanged")); + } + + [Bindable("zChanged")] + [Inspectable(category="General")] + + /** + * @inheritDoc + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 1.5 + * @productversion Flex 3 + */ + COMPILE::LATER + override public function get z():Number + { + return (_layoutFeatures == null) ? super.z : _layoutFeatures.layoutZ; + } + + /** + * @private + */ + COMPILE::LATER + override public function set z(value:Number):void + { + if (z == value) + return; + + // validateMatrix when switching between 2D/3D, works around player bug + // see sdk-23421 + var was3D:Boolean = is3D; + if (_layoutFeatures == null) + initAdvancedLayoutFeatures(); + + _layoutFeatures.layoutZ = value; + invalidateTransform(); + invalidateProperties(); + if (was3D != is3D) + validateMatrix(); + + if (hasEventListener("zChanged")) + dispatchEvent(new flex.events.Event("zChanged")); + } + + /** + * Sets the x coordinate for the transform center of the component. + * + * <p>When this component is the target of a Spark transform effect, + * you can override this property by setting + * the <code>AnimateTransform.autoCenterTransform</code> property. + * If <code>autoCenterTransform</code> is <code>false</code>, the transform + * center is determined by the <code>transformX</code>, + * <code>transformY</code>, and <code>transformZ</code> properties + * of the effect target. + * If <code>autoCenterTransform</code> is <code>true</code>, + * the effect occurs around the center of the target, + * <code>(width/2, height/2)</code>.</p> + * + * <p>Setting this property on the Spark effect class + * overrides the setting on the target component.</p> + * + * @see spark.effects.AnimateTransform#autoCenterTransform + * @see spark.effects.AnimateTransform#transformX + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + COMPILE::LATER + public function get transformX():Number + { + return (_layoutFeatures == null) ? 0 : _layoutFeatures.transformX; + } + + /** + * @private + */ + COMPILE::LATER + public function set transformX(value:Number):void + { + if (transformX == value) + return; + if (_layoutFeatures == null) + initAdvancedLayoutFeatures(); + _layoutFeatures.transformX = value; + invalidateTransform(); + invalidateProperties(); + invalidateParentSizeAndDisplayList(); + } + + /** + * Sets the y coordinate for the transform center of the component. + * + * <p>When this component is the target of a Spark transform effect, + * you can override this property by setting + * the <code>AnimateTransform.autoCenterTran
<TRUNCATED>
