我有一个使用最新 sdk 的简单测试 flash 开发空中移动项目,并尝试制作工作缩放手势。当我在我的 sgs 上启动它时,缩放手势不会发生任何事情,只是我的图像添加到舞台上。这是示例代码:
package {
import flash.display.Bitmap;
import flash.display.MovieClip;
import flash.ui.Multitouch;
import flash.events.TransformGestureEvent;
import flash.ui.MultitouchInputMode;
public class Main extends MovieClip {
[Embed(source = "elevator.png")] public static const graph:Class;
public var elevator:Bitmap;
public function Main() {
elevator = new graph();
elevator.x = 0;
elevator.y = 0;
addChild(elevator);
init();
}
private function init():void
{
if(Multitouch.supportsGestureEvents)
{
setupGestures();
} else {
trace("it no worky");
}
}
private function setupGestures():void
{
Multitouch.inputMode = MultitouchInputMode.GESTURE;
elevator.addEventListener(TransformGestureEvent.GESTURE_ROTATE, handleGestures);
elevator.addEventListener(TransformGestureEvent.GESTURE_ZOOM, handleGestures);
}
private function handleGestures(event:TransformGestureEvent):void
{
if(event.type == "gestureRotate")
{
elevator.rotation += event.rotation;
} else {
elevator.scaleX *= event.scaleX;
elevator.scaleY *= event.scaleY;
}
}
}
}
我哪里错了?
更新。这是application.xml:
<?xml version="1.0" encoding="utf-8" ?>
<id>air.multitouch</id>
<versionNumber>0.1</versionNumber>
<supportedProfiles>mobileDevice</supportedProfiles>
<filename>multitouch</filename>
<name>multitouch</name>
<description></description>
<copyright></copyright>
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
</manifest>
]]></manifestAdditions>
</android>
<iPhone>
<InfoAdditions><![CDATA[
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UIRequiresPersistentWiFi</key>
<string>NO</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIApplicationExitsOnSuspend</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<!-- iPhone support -->
<string>1</string>
<!-- iPad support -->
<!--<string>2</string>-->
</array>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
<initialWindow>
<title>multitouch</title>
<content>multitouch.swf</content>
<visible>true</visible>
<fullScreen>true</fullScreen>
<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
<renderMode>direct</renderMode>
</initialWindow>
<icon>
<image48x48>icons/icon_48.png</image48x48>
<image57x57>icons/icon_57.png</image57x57>
<image72x72>icons/icon_72.png</image72x72>
<image114x114>icons/icon_114.png</image114x114>
<image512x512>icons/icon_512.png</image512x512>
</icon>
<!--
AIR options:
http://livedocs.adobe.com/flex/3/html/File_formats_1.html#1043413
AIR mobile options:
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-5d0f4f25128cc9cd0cb-7ffe.html
Android manifest documentation:
http://developer.android.com/guide/topics/manifest/manifest-intro.html
-->
向上。这是示例.apk https://dl.dropbox.com/u/78904724/multitouch.apk