<?xml version="1.0" encoding="utf-8"?>
<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/mx" minWidth="955" minHeight="600"
               creationComplete="start();" width="663" height="464" viewSourceURL="srcview/index.html">
    <fx:Declarations>
        <s:RadioButtonGroup id="radiogroup1"/>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.core.IVisualElement;
            import mx.core.UIComponent;
            private var fullscreen:FullScreen;
            
            private function start():void 
            {
                var ui:UIComponent = new UIComponent();
                addElement(ui);
                
                var target:MyComp = new MyComp();
                target.width = 500;
                target.height = 300;
                target.label = "I'm resizable. Click me to toggle fullScreen";
                target.color = 0xFF9900;
                target.x = 20;
                target.y = 20;
                target.addEventListener(MouseEvent.CLICK, click);
                ui.addChild(target);
                
                var above:Sprite = new Sprite();
                above.graphics.beginFill(0xFF0000, 1);
                above.graphics.drawRect(0, 0, 340, 20);
                above.x = 40;
                above.y = 280;
                ui.addChild(above);
                
                var button:Button = new Button();
                button.x = 420;
                button.y = 280;
                button.label = "me too :)";
                addElement(button);
                
                var tf:TextField = new TextField();
                tf.width = 340;
                tf.height = 20;
                tf.defaultTextFormat = new TextFormat("Verdana", 11, 0xFFFFFF, true, null, null, null, null, "center");
                tf.text = "I'm above";
                above.addChild(tf);
                
                fullscreen = new FullScreen(target);
            }
            
            private function click(e:MouseEvent):void {
                fullscreen.mode = String(radiogroup1.selectedValue);
                fullscreen.toogleFullScreen();
            }
        ]]>
    </fx:Script>
    <s:Button x="298" y="342" label="fullScreen" click="click(event)"/>
    <s:RadioButton x="17" y="340" selected="true" label="resize above" value="{FullScreen.RESIZE}" groupName="radiogroup1"/>
    <s:RadioButton x="17" y="366" label="resize above width hardware acceleration" value="{FullScreen.RESIZE_HARDWARE}" groupName="radiogroup1"/>
    <s:RadioButton x="17" y="392" label="scale (hardware acceleration)" value="{FullScreen.SCALE}" groupName="radiogroup1"/>
    <s:RadioButton x="17" y="418" label="scale above (hardware aceleration)" value="{FullScreen.SCALE_ABOVE}" groupName="radiogroup1"/>
</s:Application>