套件 | mx.states |
類別 | public class State |
繼承 | State EventDispatcher Object |
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
overrides
property specifies a set of child classes
to add or remove from the base view state, and properties, styles, and event
handlers to set when the view state is in effect.
You use the State class in the states
property
of Flex components.
You can only specify a states
property at the root of an
application or a custom control, not on child controls.
You enable a view state by setting a component's
currentState
property.
The <mx:State>
tag has the following attributes:
<mx:State Properties basedOn="null" name="null" overrides="null" />
預設 MXML 屬性overrides
相關 API 元素
mx.states.RemoveChild
mx.states.SetEventHandler
mx.states.SetProperty
mx.states.SetStyle
mx.states.Transition
屬性 | 定義自 | ||
---|---|---|---|
basedOn : String
The name of the view state upon which this view state is based, or
null if this view state is not based on a named view state. | State | ||
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
name : String
The name of the view state. | State | ||
overrides : Array
The overrides for this view state, as an Array of objects that implement
the IOverride interface. | State | ||
stateGroups : Array
The state groups that this view state belongs to as an array of String. | State |
方法 | 定義自 | ||
---|---|---|---|
Constructor. | State | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | ||
會將事件傳送到事件流程。 | EventDispatcher | ||
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | ||
指出物件是否有已定義的指定屬性。 | Object | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
會傳回指定之物件的基本值。 | Object | ||
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher |
事件 | 摘要 | 定義自 | ||
---|---|---|---|---|
[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。 | EventDispatcher | |||
[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。 | EventDispatcher | |||
Dispatched after a view state has been entered. | State | |||
Dispatched just before a view state is exited. | State |
basedOn | 屬性 |
public var basedOn:String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The name of the view state upon which this view state is based, or
null
if this view state is not based on a named view state.
If this value is null
, the view state is based on a root
state that consists of the properties, styles, event handlers, and
children that you define for a component without using a State class.
預設值為 null。
name | 屬性 |
public var name:String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The name of the view state. State names must be unique for a given component. This property must be set.
overrides | 屬性 |
public var overrides:Array
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The overrides for this view state, as an Array of objects that implement the IOverride interface. These overrides are applied in order when the state is entered, and removed in reverse order when the state is exited.
The following Flex classes implement the IOverride interface and let you define the view state characteristics:
- AddChild
- RemoveChild
- SetEventHandler
- SetProperty
- SetStyle
The overrides
property is the default property of the
State class. You can omit the <mx:overrides>
tag
and its child <mx:Array>
tag if you use MXML tag
syntax to define the overrides.
stateGroups | 屬性 |
public var stateGroups:Array
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The state groups that this view state belongs to as an array of String.
State | () | 建構函式 |
enterState | 事件 |
mx.events.FlexEvent
屬性 FlexEvent.type =
mx.events.FlexEvent.ENTER_STATE
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Dispatched after a view state has been entered.
TheFlexEvent.ENTER_STATE
constant defines the value of the
type
property of the event object for a enterState
event.
This event will only be dispatched when there are one or more relevant listeners attached to the dispatching object.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The Object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
target | The Object that dispatched the event;
it is not always the Object listening for the event.
Use the currentTarget property to always access the
Object listening for the event. |
exitState | 事件 |
mx.events.FlexEvent
屬性 FlexEvent.type =
mx.events.FlexEvent.EXIT_STATE
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Dispatched just before a view state is exited. This event is dispatched before the changes to the default view state have been removed.
TheFlexEvent.EXIT_STATE
constant defines the value of the
type
property of the event object for a exitState
event.
This event will only be dispatched when there are one or more relevant listeners attached to the dispatching object.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The Object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
target | The Object that dispatched the event;
it is not always the Object listening for the event.
Use the currentTarget property to always access the
Object listening for the event. |
Tue Jun 12 2018, 03:47 PM Z