空气缩放手势根本不起作用

时间:2012-07-07 12:52:10

标签: android actionscript air gesture flashdevelop

我有一个简单的测试闪存开发空中移动项目与最新的sdk并尝试使工作缩放手势。当我在我的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
-->

UP。以下是示例.apk https://dl.dropbox.com/u/78904724/multitouch.apk

1 个答案:

答案 0 :(得分:0)

我认为这些手势只适用于InteractiveObject-s,所以将它(电梯)包装在某个Sprite中。