topical media & game development

talk show tell print

professional-flex-code-18-AddToCreationExample.mx

professional-flex-code-18-AddToCreationExample.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
      <![CDATA[
        private function traceEventHandler(event:Event):void 
        {
          trace(event.target.id +" has been created");
        }
  
        private function createContainers(even:Event):void
        {
          addToCreationQueue("box1", 2);
          addToCreationQueue("box2", 1);
          addToCreationQueue("box3", 3);
        }
      ]]>
    </mx:Script>
    <mx:VBox>
      <mx:HBox>
        <mx:HBox id="box1" 
          creationPolicy="none"  
          backgroundColor="0xFF0000" 
          width="100" height="100" 
          horizontalAlign="center" 
          verticalAlign="middle"
          creationComplete="traceEventHandler(event);">
          <mx:Text color="0xFFFFFF" text="1" fontSize="30" />
        </mx:HBox>
        <mx:HBox id="box2" 
          creationPolicy="none" 
          backgroundColor="0x0000FF" 
          width="100" height="100" 
          horizontalAlign="center" 
          verticalAlign="middle"
          creationComplete="traceEventHandler(event);">
          <mx:Text color="0xFFFFFF" text="2" fontSize="30" />
        </mx:HBox>
        <mx:HBox id="box3" 
          creationPolicy="none"  
          backgroundColor="0x00FF00" 
          width="100" height="100" 
          horizontalAlign="center" 
          verticalAlign="middle"
          creationComplete="traceEventHandler(event);">
          <mx:Text color="0xFFFFFF" text="3" fontSize="30" />
        </mx:HBox>
      </mx:HBox>
      <mx:Button label="CREATE CONTAINERS" click="createContainers(event);" />
    </mx:VBox>
  </mx:Application>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.