<?xml version="1.0" encoding="utf-8"?>

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 

xmlns:s="library://ns.adobe.com/flex/spark" viewActivate="view1_viewActivateHandler(event)" title="{data.title}" xmlns:components="components.*">

<fx:Script>

<![CDATA[

import mx.core.FlexGlobals;

import spark.events.ViewNavigatorEvent;

import views.SnippetView;

[Bindable]

private var l:String;

protected function tsRotate_changeHandler(event:Event):void

{

// TODO Auto-generated method stub

if (FlexGlobals.topLevelApplication.currentState == "portrait"){

stage.setAspectRatio(StageAspectRatio.LANDSCAPE);

}else{

stage.setAspectRatio(StageAspectRatio.PORTRAIT);

}

}

protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void

{

// TODO Auto-generated method stub

l = "Device Orientation = " + stage.deviceOrientation;

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, function(event:StageOrientationEvent):void {

l = "Device Orientation = " + stage.deviceOrientation;

});

}

protected function tsActionBar_changeHandler(event:Event):void

{

// TODO Auto-generated method stub

if(tsActionBar.selected){

this.actionBarVisible = false;

}else{

this.actionBarVisible = true;

}

}

protected function tsFullScreen_changeHandler(event:Event):void

{

// TODO Auto-generated method stub

if (tsFullScreen.selected)

{

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

}

else

{

stage.displayState = StageDisplayState.NORMAL;

}

}

]]>

</fx:Script>

<fx:Declarations>

<!-- Place non-visual elements (e.g., services, value objects) here -->

</fx:Declarations>

<s:navigationContent>

<s:Button label="Snippet" click="navigator.pushView(views.SnippetView,data)"/>

<s:Button label="Tutorial" click="navigateToURL(new URLRequest(data.tutorial))"/>

</s:navigationContent>

<s:ToggleSwitch id="tsFullScreen" x="10" y="14" label="Hello button" change="tsFullScreen_changeHandler(event)"/>

<s:ToggleSwitch id="tsActionBar" x="10" y="56" label="Hello button" change="tsActionBar_changeHandler(event)"/>

<s:ToggleSwitch id="tsRotate" change="tsRotate_changeHandler(event)" x="10" y="102" label="Hello button"/>

<s:Label x="121" y="22" text="FullScreen"/>

<s:Label x="121" y="66" text="Action bar visibility"/>

<s:Label x="121" y="111" text="{'Rotate the screen ('+l+')'}"/>

<components:QuestionBlock bottom="40" horizontalCenter="0" questionData="{data}"/>

</s:View>