Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Calling one MXML from AS code
  2. <mx:Button id="myButton" label="My Button" click="myButton_clickHandler(event)"/>
  3.        
  4. function myButton_clickHandler(event:Event):void {
  5.   var child:Child = new Child();
  6.   myVBox.addChild(child);
  7. }
  8.        
  9. <fx:Script>
  10.  <![CDATA[
  11.     private function changeState():void {
  12.         currentState = (currentState == "default") ? "showVBox" : "default";
  13.     }
  14.  ]]>
  15. </fx:Script>
  16. <s:states>
  17.   <s:State name="default"  />
  18.   <s:State name="showVBox" />
  19. </s:states>
  20.  
  21. <mx:VBox id="myVBox" includeIn="showVBox" />
  22. <mx:Button label="Show/Hide VBox" click="changeState()" />