MACROMEDIA FLEX-GETTING STARTED WITH FLEX Manuale Utente Pagina 105

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 148
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 104
application that references my open/close box that I call the
FlexiBox. The code for the application appears in Example 6-6.
Example 6-6. States.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal"
xmlns:mycomps="mycomps.*">
<mycomps:FlexiBox />
</mx:Application>
FlexiBox is an MXML component that you create using the
MXML Component command in the New menu item. The
code for the FlexiBox appears in Example 6-7.
Example 6-7. FlexiBox.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="300"
height="100"
currentState="closed" cornerRadius="5" borderColor="#ff0000"
backgroundColor="#ffdddd"
borderStyle="solid" borderThickness="3" paddingBottom="5"
paddingLeft="5"
paddingRight="5" paddingTop="5">
<mx:Script>
<![CDATA[
private function onChangerClick( event:Event ) : void {
currentState = ( currentState == "open" ) ? "closed" :
"open";
}
]]>
</mx:Script>
<mx:states>
<mx:State name="open">
<mx:SetProperty target="{this}" name="height"
value="400" />
<mx:SetProperty target="{btnChanger}" name="label"
value="Close" />
</mx:State>
<mx:State name="closed">
<mx:SetProperty target="{this}" name="height"
value="100" />
<mx:SetProperty target="{btnChanger}" name="label"
value="Open" />
States and Transitions | 89
Vedere la pagina 104
1 2 ... 100 101 102 103 104 105 106 107 108 109 110 ... 147 148

Commenti su questo manuale

Nessun commento