<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
	xmlns:mx="http://www.adobe.com/2006/mxml"
	applicationComplete="addSandySprite()"
	width="400"
	height="300"
	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:Boxes = new Boxes();
				boxes.addEventListener( BoxEvent.CLICKED, boxClickedHandler );
				spriteContainer.addChild( boxes );
			}
			
			/**
			 * The event handler for the Sandy object's click
			 * event.
			 *
			 * @see BoxEvent
			 *
			 */
			private function boxClickedHandler( event:BoxEvent ):void
			{
				textBox.text = "The " + event.which + " was clicked";
			}
		]]>
	</mx:Script>
	<mx:UIComponent id="spriteContainer" width="360" height="200" />
	<mx:TextInput id="textBox" />
</mx:Application>
