<?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 spark.events.ViewNavigatorEvent;

import views.SnippetView;

protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void

{

// TODO Auto-generated method stub

if(Multitouch.supportsGestureEvents){

Multitouch.inputMode = MultitouchInputMode.GESTURE;

img.addEventListener(TransformGestureEvent.GESTURE_ROTATE, onRotate);

img.addEventListener(TransformGestureEvent.GESTURE_ZOOM, onZoom);

img.addEventListener(TransformGestureEvent.GESTURE_PAN, onPan);

img.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe);

}else{

lbMulti.text = "Multitouch is not supported on this device";

}

}

protected function onRotate(event:TransformGestureEvent):void

{

lbMulti.text = "Multitouch gesture: Rotation";

img.rotation += event.rotation;

}

protected function onPan(event:TransformGestureEvent):void

{

lbMulti.text = "Multitouch gesture: Pan";

img.x += event.offsetX;

img.y += event.offsetY;

}

protected function onZoom(event:TransformGestureEvent):void

{

lbMulti.text = "Multitouch gesture: Zoom";

img.scaleX *= event.scaleX;

img.scaleY *= event.scaleY;

}

protected function onSwipe(event:TransformGestureEvent):void

{

lbMulti.text = "Multitouch gesture: Swipe";

img.x += 50 * event.offsetX;

img.y += 50 * event.offsetY;

}

]]>

</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:Label id="lbMulti" top="10" x="10" text="Multitouch gesture:"/>

<s:Image id="img" x="200" y="100" source="assets/images/rose.jpg"/>

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

</s:View>