<?xml version="1.0" encoding="utf-8"?>
<!---
State Sample (Custom Creation and Destruction Policies)
-->
<s:Application
    xmlns:fx      = "http://ns.adobe.com/mxml/2009"
    xmlns:s       = "library://ns.adobe.com/flex/spark"
    xmlns:mx      = "library://ns.adobe.com/flex/halo"
    xmlns:local   = "*"
    minWidth      = "1024"
    minHeight     = "768"
    viewSourceURL = "srcview/index.html"
>

    <fx:Script>
        <![CDATA[
            protected override function createChildren() : void {
                super.createChildren();
                currentState = "default";
            }
        ]]>
    </fx:Script>

    <fx:Style>
        @namespace mx "library://ns.adobe.com/flex/halo";
        @namespace s  "library://ns.adobe.com/flex/spark";
        mx|Button { font-size : 20; }
        s|Button  { font-size : 40; }
    </fx:Style>

    <s:layout>
        <s:VerticalLayout horizontalAlign="center" />
    </s:layout>

    <s:states>
        <mx:State name="default" />
        <mx:State name="aState"  />
    </s:states>

    <mx:HBox horizontalGap="0">
        <mx:Button width="150" height="50" label="default" click="currentState='default'" />
        <mx:Button width="150" height="50" label="aState"  click="currentState='aState'" />
    </mx:HBox>

    <local:CustomButton
        id                 = "A"
        label              = "Button A"
        width              = "300"
        height             = "100"
        includeIn          = "aState"
        itemCreationPolicy = "immediate"
     />

    <local:CustomButton
        id                 = "B"
        label              = "Button B"
        width              = "300"
        height             = "100"
        includeIn          = "aState"
        itemCreationPolicy = "deferred"
     />

</s:Application>