topical media & game development

talk show tell print

flex-sandy-box.mx

flex-sandy-box.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application 
          xmlns:mx="http://www.adobe.com/2006/mxml"
          applicationComplete="addSandySprite()"
          width="600"
          height="400"
          layout="vertical"
          paddingTop="0"
          paddingRight="0"
          paddingBottom="0"
          paddingLeft="0">
          <mx:Script>
                  <![CDATA[
                          
Add the Sandy object (Boxes) to the UIComponent.

  
                          private function addSandySprite():void
                          {
                                  var boxes:flex_sandy_box_item = new flex_sandy_box_item();
                                  boxes.addEventListener( flex_sandy_box_event.CLICKED, boxClickedHandler );
                                  spriteContainer.addChild( boxes );
                          }
                          
                          
The event handler for the Sandy object's click event.
see: BoxEvent

  
                          private function boxClickedHandler( event:flex_sandy_box_event ):void
                          {
                                  textBox.text = "The " + event.which + " was clicked";
                          }
                  ]]>
          </mx:Script>
          <mx:UIComponent id="spriteContainer" width="400" height="200" />
          <mx:TextInput id="textBox" />
  </mx:Application>
  


(C) Æliens 27/08/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.