////////////////////////////////////////////////////////////////////////////////
//
// 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 flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.GradientType;
import flash.display.Graphics;
import flash.display.InteractiveObject;
import flash.display.Loader;
import flash.display.Shader;
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.Event;
import flash.events.EventPhase;
import flash.events.FocusEvent;
import flash.events.IEventDispatcher;
import flash.events.KeyboardEvent;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Matrix3D;
import flash.geom.PerspectiveProjection;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.geom.Transform;
import flash.geom.Vector3D;
import flash.system.ApplicationDomain;
import flash.system.Capabilities;
import flash.text.TextFormatAlign;
import flash.text.TextLineMetrics;
import flash.ui.Keyboard;
import flash.utils.Dictionary;
import flash.utils.getQualifiedClassName;
import mx.automation.IAutomationObject;
import mx.binding.BindingManager;
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.SystemManager;
import mx.managers.SystemManagerGlobals;
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.StyleManager;
import mx.styles.StyleProtoChain;
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;
// 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 addChild()
, addChildAt()
,
* addElement()
, or addElementAt()
method.
* If the component is added to the container as a noncontent child by
* using the rawChildren.addChild()
or
* rawChildren.addChildAt()
method, the event is not dispatched.
*
*
This event is only dispatched when there are one or more relevant listeners * attached to the dispatching object.
* * @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. * *At this point, depending on its visible
property,
* the component is not visible even though it has been drawn.
commitProperties()
,
* measure()
, and
* updateDisplayList()
methods called (if needed).
*
* 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.
* *This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more relevant listeners * attached to the dispatching object.
* * @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. * *After the initialization phase, properties are processed, the component
* is measured, laid out, and drawn, after which the
* creationComplete
event is dispatched.
You can move the component by setting the x
* or y
properties, by calling the move()
* method, by setting one
* of the following properties either on the component or on other
* components such that the LayoutManager needs to change the
* x
or y
properties of the component:
minWidth
minHeight
maxWidth
maxHeight
explicitWidth
explicitHeight
When you call the move()
method, the move
* event is dispatched before the method returns.
* In all other situations, the move
event is not dispatched
* until after the property changes.
This event only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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 thepreinitialize
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 removeChild()
, removeChildAt()
,
* removeElement()
, or removeElementAt()
method.
* If the component is removed from the container as a noncontent child by
* using the rawChildren.removeChild()
or
* rawChildren.removeChildAt()
method, the event is not dispatched.
*
* This event only dispatched when there are one or more relevant listeners * attached to the dispatching object.
* * @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. * *You can resize the component by setting the width
or
* height
property, by calling the setActualSize()
* 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 width
or
* height
properties of the component:
minWidth
minHeight
maxWidth
maxHeight
explicitWidth
explicitHeight
The resize
event is not
* dispatched until after the property changes.
This event only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more relevant listeners * attached to the dispatching object.
* * @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. * *Because a programmatic change triggers this event, make sure
* that any valueCommit
event handler does not change
* a value that causes another valueCommit
event.
* For example, do not change a control's dataProvider
* property in a valueCommit
event handler.
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.
* *If you want to accept the drag, you must call the
* DragManager.acceptDragDrop()
method. If you don't
* call acceptDragDrop()
, you do not get any of the
* other drag events.
In Flash Player, the value of the action
property is always
* DragManager.MOVE
, even if you are doing a copy.
* This is because the dragEnter
event occurs before
* the control recognizes that the Control key is pressed to signal a copy.
* The action
property of the event object for the
* dragOver
event does contain a value that signifies the type of
* drag operation. You can change the type of drag action by calling the
* DragManager.showFeedback()
method.
In AIR, the default value of the action
property is
* DragManager.COPY
.
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 dragDrop
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 dragComplete
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.
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.
* *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.
* *You can also change the type of drag action by changing the
* DragManager.showFeedback()
method.
* The default value of the action
property is
* DragManager.MOVE
.
You use this event to restore the drop target to its normal appearance
* if you modified its appearance as part of handling the
* dragEnter
or dragOver
event.
You use this event handler to add the drag data to the drop target.
* *If you call Event.preventDefault()
in the event handler
* for the dragDrop
event for
* a Tree control when dragging data from one Tree control to another,
* it prevents the drop.
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.
* *If you call Event.preventDefault()
in the event handler
* for the dragComplete
event for
* a Tree control when dragging data from one Tree control to another,
* it prevents the drop.
mouseDown
or mouseMove
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.
*
* The effect does not start changing any visuals * until after this event is fired.
* * @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 tostop()
on the effect.
*
* 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 end()
.
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 callLater()
method
* to delay any other changes that you want to make until after the
* changes have been rendered onscreen.
currentState
property changes,
* but before the view state changes.
*
* This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *This event is only dispatched when there are one or more * relevant listeners attached to the dispatching object.
* * @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. * *The event is a bubbling event dispatched on the * DisplayObject that the touch interaction * started (where the mouseDown/touchBegin occurred).
* *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.
* *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.
* * @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. * *The event is a bubbling event dispatched on the * DisplayObject that the touch interaction * started (where the mouseDown/touchBegin occurred).
* *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.
* *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.
* * @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. * *The event is a bubbling event dispatched on the * DisplayObject that the touch interaction * started (where the mouseDown/touchBegin occurred).
* *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.
* *A Scroller component will dispatch a touchInteractionEnd event * to alert other components that it is done responding to the user's * touch interaction.
* * @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. * *If you create your own IToolTip object and place a reference
* to it in the toolTip
property of the event object
* that is passed to your toolTipCreate
handler,
* the ToolTipManager displays your custom ToolTip.
* Otherwise, the ToolTipManager creates an instance of
* ToolTipManager.toolTipClass
to display.
The sequence of ToolTip events is toolTipStart
,
* toolTipCreate
, toolTipShow
,
* toolTipShown
, toolTipHide
,
* and toolTipEnd
.
If you specify an effect using the
* ToolTipManager.hideEffect
property,
* this event is dispatched after the effect stops playing.
The sequence of ToolTip events is toolTipStart
,
* toolTipCreate
, toolTipShow
,
* toolTipShown
, toolTipHide
,
* and toolTipEnd
.
If you specify an effect using the
* ToolTipManager.hideEffect
property,
* this event is dispatched before the effect starts playing.
The sequence of ToolTip events is toolTipStart
,
* toolTipCreate
, toolTipShow
,
* toolTipShown
, toolTipHide
,
* and toolTipEnd
.
If you specify an effect using the
* ToolTipManager.showEffect
property,
* this event is dispatched before the effect starts playing.
* You can use this event to modify the ToolTip before it appears.
The sequence of ToolTip events is toolTipStart
,
* toolTipCreate
, toolTipShow
,
* toolTipShown
, toolTipHide
,
* and toolTipEnd
.
If you specify an effect using the
* ToolTipManager.showEffect
property,
* this event is dispatched after the effect stops playing.
The sequence of ToolTip events is toolTipStart
,
* toolTipCreate
, toolTipShow
,
* toolTipShown
, toolTipHide
,
* and toolTipEnd
.
toolTip
property is set,
* as soon as the user moves the mouse over it.
*
* The sequence of ToolTip events is toolTipStart
,
* toolTipCreate
, toolTipShow
,
* toolTipShown
, toolTipHide
,
* and toolTipEnd
.
borderColor
style of the component to this
* errorColor
on a validation failure.
*
* The default value for the Halo theme is 0xFF0000
.
* The default value for the Spark theme is 0xFE0000
.
*
* @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:
* mouse
and touch
.
*
* The default value for the Halo theme is mouse
.
* The default value for the Spark theme is mouse
.
* The default value for the Mobile theme is touch
.
*
* @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 blendMode
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 "ltr"
for left-to-right layout, used for
* components using Latin-style scripts, and "rtl"
for
* right-to-left layout, used for components using scripts such
* as Arabic and Hebrew.
*
* In ActionScript you can set the layoutDirection using the values
* mx.core.LayoutDirection.LTR
,
* mx.core.LayoutDirection.RTL
or
* undefined
, to inherit the layoutDirection from the parent.
The layoutDirection should typically be set on the
* Application
rather than on individual components. If the
* layoutDirection is "rtl"
, most visual elements, except text
* and images, will be mirrored. The directionality of text is determined
* by the direction
style.
Components which handle Keyboard.LEFT and Keyboard.RIGHT events
* typically swap the key’s meaning when layoutDirection is
* “rtl”
. In other words, left always means move left and
* right always means move right, regardless of the
* layoutDirection
Note: This style applies to all Spark components and MX components that * specify UIFTETextField as their textFieldClass.
* * @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 arehaloGreen
, haloBlue
,
* haloOrange
, and haloSilver
, although any valid color
* value can be used.
*
* The default values of the rollOverColor
and
* selectionColor
styles are based on the
* themeColor
value.
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.
*The UIComponent class is not used as an MXML tag, but is used as a base * class for other classes.
* * @mxml * *All user interface components in Flex extend the UIComponent class. * Flex components inherit the following properties from the UIComponent * class:
* ** <mx:tagname * Properties * 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" * * Styles * bottom="undefined" * errorColor="0xFF0000" * focusBlendMode="normal" * focusSkin="HaloFocusRect"" * focusThickness="2" * horizontalCenter="undefined" * layoutDirection="ltr" * left="undefined" * right="undefined" * themeColor="haloGreen" * top="undefined" * verticalCenter="undefined" * * Effects * addedEffect="No default" * creationCompleteEffect="No default" * focusInEffect="No default" * focusOutEffect="No default" * hideEffect="No default" * mouseDownEffect="No default" * mouseUpEffect="No default" * moveEffect="No default" * removedEffect="No default" * resizeEffect="No default" * rollOutEffect="No default" * rollOverEffect="No default" * showEffect="No default" * * Events * add="No default" * creationComplete="No default" * currentStateChange="No default" * currentStateChanging="No default" * dragComplete="No default" * dragDrop="No default" * dragEnter="No default" * dragExit="No default" * dragOver="No default" * effectEnd="No default" * effectStart="No default" * enterState="No default" * exitState="No default" * hide="No default" * initialize="No default" * invalid="No default" * mouseDownOutside="No default" * mouseWheelOutside="No default" * move="No default" * preinitialize="No default" * remove="No default" * resize="No default" * show="No default" * toolTipCreate="No default" * toolTipEnd="No default" * toolTipHide="No default" * toolTipShow="No default" * toolTipShown="No default" * toolTipStart="No default" * updateComplete="No default" * valid="No default" * valueCommit="No default" * > ** * @see mx.core.UIComponent * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class UIComponent extends FlexSprite 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
measuredWidth
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 measuredMinWidth
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 measuredHeight
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 measuredMinHeight
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 maxWidth
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 maxHeight
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 callLater()
,
* until resumeBackgroundProcessing()
is called.
*
* These methods can be useful when you have time-critical code
* which needs to execute without interruption.
* For example, when you set the suspendBackgroundProcessing
* property of an Effect to true
,
* suspendBackgroundProcessing()
is automatically called
* when it starts playing, and resumeBackgroundProcessing
* is called when it stops, in order to ensure that the animation
* is smooth.
Since the LayoutManager uses callLater()
,
* this means that commitProperties()
,
* measure()
, and updateDisplayList()
* is not called in between calls to
* suspendBackgroundProcessing()
and
* resumeBackgroundProcessing()
.
It is safe for both an outer method and an inner method
* (i.e., one that the outer methods calls) to call
* suspendBackgroundProcessing()
* and resumeBackgroundProcessing()
, because these
* methods actually increment and decrement a counter
* which determines whether background processing occurs.
callLater()
, after a call to
* suspendBackgroundProcessing()
.
*
* Refer to the description of
* suspendBackgroundProcessing()
for more information.
true
after immediate or deferred child creation,
* depending on which one happens. For a Container object, it is set
* to true
at the end of
* the createComponentsFromDescriptors()
method,
* meaning after the Container object creates its children from its child descriptors.
*
* For example, if an Accordion container uses deferred instantiation,
* the processedDescriptors
property for the second pane of
* the Accordion container does not become true
until after
* the user navigates to that pane and the pane creates its children.
* But, if the Accordion had set the creationPolicy
property
* to "all"
, the processedDescriptors
property
* for its second pane is set to true
during application startup.
For classes that are not containers, which do not have descriptors,
* it is set to true
after the createChildren()
* method creates any internal component children.
silent
property
* in this UIComponent's accessibilityProperties
object.
*
* Note that accessibilityEnabled
has the opposite sense from silent;
* accessibilityEnabled
is true
* when silent
is false
.
The getter simply returns accessibilityProperties.silent
,
* or true
if accessibilityProperties
is null.
* The setter first checks whether accessibilityProperties
is null,
* and if it is, sets it to a new AccessibilityProperties instance.
* Then it sets accessibilityProperties.silent
.
name
property
* in this UIComponent's accessibilityProperties
object.
*
* The getter simply returns accessibilityProperties.name
,
* or "" if accessibilityProperties is null.
* The setter first checks whether accessibilityProperties
is null,
* and if it is, sets it to a new AccessibilityProperties instance.
* Then it sets accessibilityProperties.name
.
description
property
* in this UIComponent's accessibilityProperties
object.
*
* The getter simply returns accessibilityProperties.description
,
* or "" if accessibilityProperties
is null.
* The setter first checks whether accessibilityProperties
is null,
* and if it is, sets it to a new AccessibilityProperties instance.
* Then it sets accessibilityProperties.description
.
shortcut
property
* in this UIComponent's accessibilityProperties
object.
*
* The getter simply returns accessibilityProperties.shortcut
,
* or "" if accessibilityProperties
is null.
* The setter first checks whether accessibilityProperties
is null,
* and if it is, sets it to a new AccessibilityProperties instance.
* Then it sets accessibilityProperties.shortcut
.
Setting this property directly or calling move()
* 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 x
position to the results of the calculation.
* However, the x
property must almost always be set
* when the parent is a Canvas or other absolute-positioning
* container because the default value is 0.
When this component is the target of a Spark transform effect,
* you can override this property by setting
* the AnimateTransform.autoCenterTransform
property.
* If autoCenterTransform
is false
, the transform
* center is determined by the transformX
,
* transformY
, and transformZ
properties
* of the effect target.
* If autoCenterTransform
is true
,
* the effect occurs around the center of the target,
* (width/2, height/2)
.
Setting this property on the Spark effect class * overrides the setting on the target component.
* * @see spark.effects.AnimateTransform#autoCenterTransform * @see spark.effects.AnimateTransform#transformX * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get transformX():Number { return (_layoutFeatures == null) ? 0 : _layoutFeatures.transformX; } /** * @private */ 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. * *When this component is the target of a Spark transform effect,
* you can override this property by setting
* the AnimateTransform.autoCenterTransform
property.
* If autoCenterTransform
is false
, the transform
* center is determined by the transformX
,
* transformY
, and transformZ
properties
* of the effect target.
* If autoCenterTransform
is true
,
* the effect occurs around the center of the target,
* (width/2, height/2)
.
Seeting this property on the Spark effect class * overrides the setting on the target component.
* * @see spark.effects.AnimateTransform#autoCenterTransform * @see spark.effects.AnimateTransform#transformY * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get transformY():Number { return (_layoutFeatures == null) ? 0 : _layoutFeatures.transformY; } /** * @private */ public function set transformY(value:Number):void { if (transformY == value) return; if (_layoutFeatures == null) initAdvancedLayoutFeatures(); _layoutFeatures.transformY = value; invalidateTransform(); invalidateProperties(); invalidateParentSizeAndDisplayList(); } /** * Sets the z coordinate for the transform center of the component. * *When this component is the target of a Spark transform effect,
* you can override this property by setting
* the AnimateTransform.autoCenterTransform
property.
* If autoCenterTransform
is false
, the transform
* center is determined by the transformX
,
* transformY
, and transformZ
properties
* of the effect target.
* If autoCenterTransform
is true
,
* the effect occurs around the center of the target,
* (width/2, height/2)
.
Seeting this property on the Spark effect class * overrides the setting on the target component.
* * @see spark.effects.AnimateTransform#autoCenterTransform * @see spark.effects.AnimateTransform#transformZ * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get transformZ():Number { return (_layoutFeatures == null) ? 0 : _layoutFeatures.transformZ; } /** * @private */ public function set transformZ(value:Number):void { if (transformZ == value) return; if (_layoutFeatures == null) initAdvancedLayoutFeatures(); _layoutFeatures.transformZ = value; invalidateTransform(); invalidateProperties(); invalidateParentSizeAndDisplayList(); } /** * @copy mx.core.IFlexDisplayObject#rotation * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override public function get rotation():Number { if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_0) return super.rotation; return (_layoutFeatures == null) ? super.rotation : _layoutFeatures.layoutRotationZ; } /** * @private */ override public function set rotation(value:Number):void { if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_0) { super.rotation = value; return; } if (rotation == value) return; _hasComplexLayoutMatrix = true; if (_layoutFeatures == null) { // clamp the rotation value between -180 and 180. This is what // the Flash player does and what we mimic in CompoundTransform; // however, the Flash player doesn't handle values larger than // 2^15 - 1 (FP-749), so we need to clamp even when we're // just setting super.rotation. super.rotation = MatrixUtil.clampRotation(value); } else { _layoutFeatures.layoutRotationZ = value; } invalidateTransform(); invalidateProperties(); invalidateParentSizeAndDisplayList(); } /** * @inheritDoc * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override public function get rotationZ():Number { return rotation; } /** * @private */ override public function set rotationZ(value:Number):void { rotation = value; } /** * Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation * relative to the 3D parent container. Values from 0 to 180 represent clockwise rotation; values * from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from * 360 to obtain a value within the range. * * This property is ignored during calculation by any of Flex's 2D layouts. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 3 */ override public function get rotationX():Number { return (_layoutFeatures == null) ? super.rotationX : _layoutFeatures.layoutRotationX; } /** * @private */ override public function set rotationX(value:Number):void { if (rotationX == value) return; // validateMatrix when switching between 2D/3D, works around player bug // see sdk-23421 var was3D:Boolean = is3D; if (_layoutFeatures == null) initAdvancedLayoutFeatures(); _layoutFeatures.layoutRotationX = value; invalidateTransform(); invalidateProperties(); invalidateParentSizeAndDisplayList(); if (was3D != is3D) validateMatrix(); } /** * Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation * relative to the 3D parent container. Values from 0 to 180 represent clockwise rotation; values * from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from * 360 to obtain a value within the range. * * This property is ignored during calculation by any of Flex's 2D layouts. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override public function get rotationY():Number { return (_layoutFeatures == null) ? super.rotationY : _layoutFeatures.layoutRotationY; } /** * @private */ override public function set rotationY(value:Number):void { if (rotationY == value) return; // validateMatrix when switching between 2D/3D, works around player bug // see sdk-23421 var was3D:Boolean = is3D; if (_layoutFeatures == null) initAdvancedLayoutFeatures(); _layoutFeatures.layoutRotationY = value; invalidateTransform(); invalidateProperties(); invalidateParentSizeAndDisplayList(); if (was3D != is3D) validateMatrix(); } //---------------------------------- // y //---------------------------------- [Bindable("yChanged")] [Inspectable(category="General")] /** * Number that specifies the component's vertical position, * in pixels, within its parent container. * *Setting this property directly or calling move()
* 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 x
position to the results of the calculation.
* However, the x
property must almost always be set
* when the parent is a Canvas or other absolute-positioning
* container because the default value is 0.
Note: You can specify a percentage value in the MXML
* width
attribute, such as width="100%"
,
* but you cannot use a percentage value in the width
* property in ActionScript.
* Use the percentWidth
property instead.
Setting this property causes a resize
event to
* be dispatched.
* See the resize
event for details on when
* this event is dispatched.
Note: You can specify a percentage value in the MXML
* height
attribute, such as height="100%"
,
* but you cannot use a percentage value for the height
* property in ActionScript;
* use the percentHeight
property instead.
Setting this property causes a resize
event to be dispatched.
* See the resize
event for details on when
* this event is dispatched.
The default value is 1.0, which means that the object
* is not scaled.
* A scaleX
of 2.0 means the object has been
* magnified by a factor of 2, and a scaleX
of 0.5
* means the object has been reduced by a factor of 2.
A value of 0.0 is an invalid value.
* Rather than setting it to 0.0, set it to a small value, or set
* the visible
property to false
to hide the component.
The default value is 1.0, which means that the object
* is not scaled.
* A scaleY
of 2.0 means the object has been
* magnified by a factor of 2, and a scaleY
of 0.5
* means the object has been reduced by a factor of 2.
A value of 0.0 is an invalid value.
* Rather than setting it to 0.0, set it to a small value, or set
* the visible
property to false
to hide the component.
A scaling along the z axis does not affect a typical component, which lies flat * in the z=0 plane. components with children that have 3D transforms applied, or * components with a non-zero transformZ, is affected.
* *The default value is 1.0, which means that the object * is not scaled.
* *This property is ignored during calculation by any of Flex's 2D layouts.
* * @default 1.0 * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override public function get scaleZ():Number { return (_layoutFeatures == null) ? super.scaleZ : _layoutFeatures.layoutScaleZ; } /** * @private */ override public function set scaleZ(value:Number):void { if (scaleZ == value) return; // validateMatrix when switching between 2D/3D, works around player bug // see sdk-23421 var was3D:Boolean = is3D; if (_layoutFeatures == null) initAdvancedLayoutFeatures(); _hasComplexLayoutMatrix = true; _layoutFeatures.layoutScaleZ = value; invalidateTransform(); invalidateProperties(); invalidateParentSizeAndDisplayList(); if (was3D != is3D) validateMatrix(); dispatchEvent(new Event("scaleZChanged")); } /** * This property allows access to the Player's native implementation * of thescaleX
property, which can be useful since components
* can override scaleX
and thereby hide the native implementation.
* Note that this "base property" is final and cannot be overridden,
* so you can count on it to reflect what is happening at the player level.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
mx_internal final function get $scaleX():Number
{
return super.scaleX;
}
mx_internal final function set $scaleX(value:Number):void
{
super.scaleX = value;
}
/**
* This property allows access to the Player's native implementation
* of the scaleY
property, which can be useful since components
* can override scaleY
and thereby hide the native implementation.
* Note that this "base property" is final and cannot be overridden,
* so you can count on it to reflect what is happening at the player level.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
mx_internal final function get $scaleY():Number
{
return super.scaleY;
}
mx_internal final function set $scaleY(value:Number):void
{
super.scaleY = value;
}
//----------------------------------
// visible
//----------------------------------
/**
* @private
* Storage for the visible property.
*/
private var _visible:Boolean = true;
[Bindable("hide")]
[Bindable("show")]
[Inspectable(category="General", defaultValue="true")]
/**
* Whether or not the display object is visible.
* Display objects that are not visible are disabled.
* For example, if visible=false
for an InteractiveObject instance,
* it cannot be clicked.
*
* When setting to true
, the object dispatches
* a show
event.
* When setting to false
, the object dispatches
* a hide
event.
* In either case the children of the object does not emit a
* show
or hide
event unless the object
* has specifically written an implementation to do so.
visible
property changes.
* Set the visible
property to show or hide
* a component instead of calling this method directly.
*
* @param value The new value of the visible
property.
* Specify true
to show the component, and false
to hide it.
*
* @param noEvent If true
, do not dispatch an event.
* If false
, dispatch a show
event when
* the component becomes visible, and a hide
event when
* the component becomes invisible.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function setVisible(value:Boolean,
noEvent:Boolean = false):void
{
_visible = value;
if (!initialized)
return;
if (designLayer && !designLayer.effectiveVisibility)
value = false;
if ($visible == value)
return;
$visible = value;
if (!noEvent)
{
var eventType:String = value ? FlexEvent.SHOW :FlexEvent.HIDE;
if (hasEventListener(eventType))
dispatchEvent(new FlexEvent(eventType));
}
}
//----------------------------------
// alpha
//----------------------------------
/**
* @private
* Storage for the alpha property.
*/
private var _alpha:Number = 1.0;
[Bindable("alphaChanged")]
[Inspectable(defaultValue="1.0", category="General", verbose="1", minValue="0.0", maxValue="1.0")]
/**
* @private
*/
override public function get alpha():Number
{
// Here we roundtrip alpha in the same manner as the
// player (purposely introducing a rounding error).
return int(_alpha * 256.0) / 256.0;
}
/**
* @private
*/
override public function set alpha(value:Number):void
{
if (_alpha != value)
{
_alpha = value;
if (designLayer)
value = value * designLayer.effectiveAlpha;
$alpha = value;
dispatchEvent(new Event("alphaChanged"));
}
}
//----------------------------------
// blendMode
//----------------------------------
/**
* @private
* Storage for the blendMode property.
*/
private var _blendMode:String = BlendMode.NORMAL;
private var blendShaderChanged:Boolean;
private var blendModeChanged:Boolean;
[Inspectable(category="General", enumeration="add,alpha,darken,difference,erase,hardlight,invert,layer,lighten,multiply,normal,subtract,screen,overlay,colordodge,colorburn,exclusion,softlight,hue,saturation,color,luminosity", defaultValue="normal")]
/**
* @private
*/
override public function get blendMode():String
{
return _blendMode;
}
/**
* @private
*/
override public function set blendMode(value:String):void
{
if (_blendMode != value)
{
_blendMode = value;
blendModeChanged = true;
// If one of the non-native Flash blendModes is set,
// record the new value and set the appropriate
// blendShader on the display object.
if (value == "colordodge" ||
value =="colorburn" || value =="exclusion" ||
value =="softlight" || value =="hue" ||
value =="saturation" || value =="color" ||
value =="luminosity")
{
blendShaderChanged = true;
}
invalidateProperties();
}
}
//----------------------------------
// doubleClickEnabled
//----------------------------------
[Inspectable(enumeration="true,false", defaultValue="true")]
/**
* Specifies whether the UIComponent object receives doubleClick
events.
* The default value is false
, which means that the UIComponent object
* does not receive doubleClick
events.
*
* The mouseEnabled
property must also be set to true
,
* its default value, for the object to receive doubleClick
events.
Used to alert the EffectManager that certain properties of this object * are being tweened, so that the EffectManger doesn't attempt to animate * the same properties.
* * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get tweeningProperties():Array { return _tweeningProperties; } /** * @private */ public function set tweeningProperties(value:Array):void { _tweeningProperties = value; } //-------------------------------------------------------------------------- // // Properties: Manager access // //-------------------------------------------------------------------------- //---------------------------------- // cursorManager //---------------------------------- /** * Gets the CursorManager that controls the cursor for this component * and its peers. * Each top-level window has its own instance of a CursorManager; * To make sure you're talking to the right one, use this method. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get cursorManager():ICursorManager { var o:DisplayObject = parent; while (o) { if (o is IUIComponent && "cursorManager" in o) { var cm:ICursorManager = o["cursorManager"]; return cm; } o = o.parent; } return CursorManager.getInstance(); } //---------------------------------- // focusManager //---------------------------------- /** * @private * Storage for the focusManager property. */ private var _focusManager:IFocusManager; [Inspectable(environment="none")] /** * Gets the FocusManager that controls focus for this component * and its peers. * Each popup has its own focus loop and therefore its own instance * of a FocusManager. * To make sure you're talking to the right one, use this method. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get focusManager():IFocusManager { if (_focusManager) return _focusManager; var o:DisplayObject = parent; while (o) { if (o is IFocusManagerContainer) return IFocusManagerContainer(o).focusManager; o = o.parent; } return null; } /** * @private * IFocusManagerContainers have this property assigned by the framework */ public function set focusManager(value:IFocusManager):void { _focusManager = value; dispatchEvent(new FlexEvent(FlexEvent.ADD_FOCUS_MANAGER)); } //---------------------------------- // resourceManager //---------------------------------- /** * @private * Storage for the resourceManager property. */ private var _resourceManager:IResourceManager = ResourceManager.getInstance(); /** * @private * This metadata suppresses a trace() in PropertyWatcher: * "warning: unable to bind to property 'resourceManager' ..." */ [Bindable("unused")] /** * A reference to the object which manages * all of the application's localized resources. * This is a singleton instance which implements * the IResourceManager interface. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ protected function get resourceManager():IResourceManager { return _resourceManager; } //---------------------------------- // styleManager //---------------------------------- /** * @private */ private var _styleManager:IStyleManager2; /** * Returns the StyleManager instance used by this component. * * @langversion 3.0 * @playerversion Flash 10 * @playerversion AIR 1.5 * @productversion Flex 4 */ public function get styleManager():IStyleManager2 { if (!_styleManager) _styleManager = StyleManager.getStyleManager(moduleFactory); return _styleManager; } //---------------------------------- // systemManager //---------------------------------- /** * @private * Storage for the systemManager property. * Set by the SystemManager so that each UIComponent * has a references to its SystemManager */ private var _systemManager:ISystemManager; /** * @private * if component has been reparented, we need to potentially * reassign systemManager, cause we could be in a new Window. */ private var _systemManagerDirty:Boolean = false; [Inspectable(environment="none")] /** * Returns the SystemManager object used by this component. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get systemManager():ISystemManager { if (!_systemManager || _systemManagerDirty) { var r:DisplayObject = root; if (_systemManager && _systemManager.isProxy) { // keep the existing proxy } else if (r && !(r is Stage)) { // If this object is attached to the display list, then // the root property holds its SystemManager. _systemManager = (r as ISystemManager); } else if (r) { // if the root is the Stage, then we are in a second AIR window _systemManager = Stage(r).getChildAt(0) as ISystemManager; } else { // If this object isn't attached to the display list, then // we need to walk up the parent chain ourselves. var o:DisplayObjectContainer = parent; while (o) { var ui:IUIComponent = o as IUIComponent; if (ui) { _systemManager = ui.systemManager; break; } else if (o is ISystemManager) { _systemManager = o as ISystemManager; break; } o = o.parent; } } _systemManagerDirty = false; } return _systemManager; } /** * @private */ public function set systemManager(value:ISystemManager):void { _systemManager = value; _systemManagerDirty = false; } /** * @private * Returns the current system manager,systemManager
,
* unless it is null.
* If the current system manager is null,
* then search to find the correct system manager.
*
* @return A system manager. This value is never null.
*/
mx_internal function getNonNullSystemManager():ISystemManager
{
var sm:ISystemManager = systemManager;
if (!sm)
sm = ISystemManager(SystemManager.getSWFRoot(this));
if (!sm)
return SystemManagerGlobals.topLevelSystemManagers[0];
return sm;
}
/**
* @private
*/
protected function invalidateSystemManager():void
{
var childList:IChildList = (this is IRawChildrenContainer) ?
IRawChildrenContainer(this).rawChildren : IChildList(this);
var n:int = childList.numChildren;
for (var i:int = 0; i < n; i++)
{
var child:UIComponent = childList.getChildAt(i) as UIComponent;
if (child)
child.invalidateSystemManager();
}
_systemManagerDirty = true;
}
//----------------------------------
// nestLevel
//----------------------------------
/**
* @private
* Storage for the nestLevel property.
*/
private var _nestLevel:int = 0;
[Inspectable(environment="none")]
/**
* Depth of this object in the containment hierarchy.
* This number is used by the measurement and layout code.
* The value is 0 if this component is not on the DisplayList.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get nestLevel():int
{
return _nestLevel;
}
/**
* @private
*/
public function set nestLevel(value:int):void
{
// If my parent hasn't been attached to the display list, then its nestLevel
// will be zero. If it tries to set my nestLevel to 1, ignore it. We'll
// update nest levels again after the parent is added to the display list.
if (value == 1)
return;
// Also punt if the new value for nestLevel is the same as my current value.
// TODO: (aharui) add early exit if nestLevel isn't changing
if (value > 1 && _nestLevel != value)
{
_nestLevel = value;
updateCallbacks();
value ++;
}
else if (value == 0)
_nestLevel = value = 0;
else
value ++;
var childList:IChildList = (this is IRawChildrenContainer) ?
IRawChildrenContainer(this).rawChildren : IChildList(this);
var n:int = childList.numChildren;
for (var i:int = 0; i < n; i++)
{
var ui:ILayoutManagerClient = childList.getChildAt(i) as ILayoutManagerClient;
if (ui)
{
ui.nestLevel = value;
}
else
{
var textField:IUITextField = childList.getChildAt(i) as IUITextField;
if (textField)
textField.nestLevel = value;
}
}
}
//--------------------------------------------------------------------------
//
// Properties: MXML
//
//--------------------------------------------------------------------------
//----------------------------------
// descriptor
//----------------------------------
/**
* @private
* Storage for the descriptor property.
* This variable is initialized in the construct() method
* using the _descriptor in the initObj, which is set in
* createComponentFromDescriptor().
* If this UIComponent was not created by createComponentFromDescriptor(),
* its 'descriptor' property is null.
*/
mx_internal var _descriptor:UIComponentDescriptor;
[Inspectable(environment="none")]
/**
* Reference to the UIComponentDescriptor, if any, that was used
* by the createComponentFromDescriptor()
method to create this
* UIComponent instance. If this UIComponent instance
* was not created from a descriptor, this property is null.
*
* @see mx.core.UIComponentDescriptor
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get descriptor():UIComponentDescriptor
{
return _descriptor;
}
/**
* @private
*/
public function set descriptor(value:UIComponentDescriptor):void
{
_descriptor = value;
}
//----------------------------------
// document
//----------------------------------
/**
* @private
* Storage for the document property.
* This variable is initialized in the init() method.
* A document object (i.e., an Object at the top of the hierarchy
* of a Flex application, MXML component, or AS component) has an
* autogenerated override of initalize() which sets its _document to
* 'this', so that its 'document' property is a reference to itself.
* Other UIComponents set their _document to their parent's _document,
* so that their 'document' property refers to the document object
* that they are inside.
*/
mx_internal var _document:Object;
[Inspectable(environment="none")]
/**
* A reference to the document object associated with this UIComponent.
* A document object is an Object at the top of the hierarchy of a
* Flex application, MXML component, or AS component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get document():Object
{
return _document;
}
/**
* A reference to the document object associated with this UIComponent.
* A document object is an Object at the top of the hierarchy of a
* Flex application, MXML component, or AS component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function set document(value:Object):void
{
var n:int = numChildren;
for (var i:int = 0; i < n; i++)
{
var child:IUIComponent = getChildAt(i) as IUIComponent;
if (!child)
continue;
if (child.document == _document ||
child.document == FlexGlobals.topLevelApplication)
{
child.document = value;
}
}
_document = value;
}
//----------------------------------
// documentDescriptor
//----------------------------------
/**
* @private
* Storage for the documentDescriptor property.
* A document object (i.e., a UIComponent at the top of the
* hierarchy of a Flex application, MXML component,
* or AS component) has an autogenerated override of init()
* which sets its _documentDescriptor to the descriptor
* at the top of the autogenerated descriptor tree for that
* document. For other UIComponents, _documentDescriptor is
* never defined.
*/
mx_internal var _documentDescriptor:UIComponentDescriptor;
/**
* @private
* For a document object, which is an instance of a UIComponent
* at the top of the hierarchy of a Flex application, MXML
* component, or ActionScript component, the
* documentDescriptor
property is a reference
* to the UIComponentDescriptor at the top of the autogenerated
* descriptor tree for that document, which describes the
* set of children and their attributes for that document.
* For other UIComponents, it is null
.
*/
mx_internal function get documentDescriptor():UIComponentDescriptor
{
return _documentDescriptor;
}
//----------------------------------
// id
//----------------------------------
/**
* @private
*/
private var _id:String;
/**
* ID of the component. This value becomes the instance name of the object
* and should not contain any white space or special characters. Each component
* throughout an application should have a unique id.
*
* If your application is going to be tested by third party tools, give each component * a meaningful id. Testing tools use ids to represent the control in their scripts and * having a meaningful name can make scripts more readable. For example, set the * value of a button to submit_button rather than b1 or button1.
* * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function get id():String { return _id; } /** * @private */ public function set id(value:String):void { _id = value; } //---------------------------------- // isDocument //---------------------------------- /** * Containstrue
if this UIComponent instance is a document object.
* That means it is at the top of the hierarchy of a Flex
* application, MXML component, or ActionScript component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public function get isDocument():Boolean
{
return document == this;
}
//----------------------------------
// parentApplication
//----------------------------------
[Bindable("initialize")]
/*
* Note:
* There are two reasons that 'parentApplication' is typed as Object
* rather than as Application. The first is that typing it as Application
* would make UIComponent dependent on Application, slowing down compile
* times not only for SWCs for also for MXML and AS components. The
* second is that authors would not be able to access properties and
* methods in the