flex4.6支持5种手势
gesturePan,gestureZoom,gestureRotate,gestureSwipe,gestureTwoFingerTap
如下的测试代码
<?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" title="Supported Gestures" initialize="init()">
<fx:Script>
<![CDATA[
import flash.ui.Multitouch;
private function init():void {
for each(var gesture:String in Multitouch.supportedGestures)
{
this[gesture+"Enabled"].selected = true;
addEventListener(gesture, function(e:GestureEvent):void {
e.currentTarget[e.type+"Tested"].selected = true;
});
}
}
]]> </fx:Script>
<s:VGroup paddingTop="15" paddingBottom="15" paddingLeft="20" paddingRight="20" gap="10">
<s:HGroup verticalAlign="middle" gap="20">
<s:Label text="Pan" fontSize="36" width="110"/>
<s:Image source="@Embed('/gestures/pan.png')" width="137"/>
<s:VGroup gap="10">
<s:CheckBox id="gesturePanEnabled" content="Enabled" mouseEnabled="false"/>
<s:CheckBox id="gesturePanTested" content="Tested" mouseEnabled="false"/>
</s:VGroup>
</s:HGroup>
<s:HGroup verticalAlign="middle" gap="20">
<s:Label text="Rotate" fontSize="36" width="110"/>
<s:Image source="@Embed('/gestures/rotate.png')" width="137"/>
<s:VGroup gap="10">
<s:CheckBox id="gestureRotateEnabled" content="Enabled" mouseEnabled="false"/>
<s:CheckBox id="gestureRotateTested" content="Tested" mouseEnabled="false"/>
</s:VGroup>
</s:HGroup>
<s:HGroup verticalAlign="middle" gap="20">
<s:Label text="Zoom" fontSize="36" width="110"/>
<s:Image source="@Embed('/gestures/zoom.png')" width="137"/>
<s:VGroup gap="10">
<s:CheckBox id="gestureZoomEnabled" content="Enabled" mouseEnabled="false"/>
<s:CheckBox id="gestureZoomTested" content="Tested" mouseEnabled="false"/>
</s:VGroup>
</s:HGroup>
<s:HGroup verticalAlign="middle" gap="20">
<s:Label text="Swipe" fontSize="36" width="110"/>
<s:Image source="@Embed('/gestures/swipe.png')" width="137"/>
<s:VGroup gap="10">
<s:CheckBox id="gestureSwipeEnabled" content="Enabled" mouseEnabled="false"/>
<s:CheckBox id="gestureSwipeTested" content="Tested" mouseEnabled="false"/>
</s:VGroup>
</s:HGroup>
<s:HGroup verticalAlign="middle" gap="20">
<s:Label text="Two-Finger Tap" fontSize="36" width="110"/>
<s:Image source="@Embed('/gestures/twoFingerTap.png')" width="137"/>
<s:VGroup gap="10">
<s:CheckBox id="gestureTwoFingerTapEnabled" content="Enabled" mouseEnabled="false"/>
<s:CheckBox id="gestureTwoFingerTapTested" content="Tested" mouseEnabled="false"/>
</s:VGroup>
</s:HGroup>
<s:Label text="Graphics courtesy of GestureWorks.com" fontSize="12"/>
</s:VGroup>
</s:View>