mx.states

 

文檔上這樣寫的:

The State class defines a view state, a particular view of a component. For example, a product thumbnail could have two view states; a base view state with minimal information, and a rich view state with additional information. The 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.

 

可以這樣理解:

 

Flex沒有頁面跳轉,但是不能總在一個頁面玩啊,通過states 就可以模擬實現。

<mx:states>
 <mx:State name="1">
<!--想要顯示什麼,想要隱藏什麼-->
</mx:State>
 <mx:State name="2">
</mx:State>
 <mx:State name="3">
</mx:State>
</mx:states>

  通過設置

currentState='1' 或者currentState='2' currentState='3'

來達到顯示1,2或者3裏的內容。類似於通過javascript來設置HTML頁面某些控件顯示或者某些隱藏來達到顯示不同的view功能。

 

例子看:http://livedocs.adobe.com/flex/3/langref/mx/states/State.html#mxmlSyntaxSummary

        http://blog.minidx.com/2008/10/14/1521.html

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章