开发者

Flash packager for IOS and touch events

I am trying Flash CS5 for ios development, but TouchEvents don't works on my ipod. My ipod is jailbroken. The code I try is here:

package {

import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.TouchEvent;



public class touch extends MovieClip {

    public var square:Sprite;
    public function touch() {
        square = new Sprite();
        add开发者_Python百科Child(square);
        square.graphics.lineStyle(3,0x00ff00);
        square.graphics.beginFill(0x0000FF);
        square.graphics.drawRect(0,0,100,100);
        square.graphics.endFill();
        square.x = stage.stageWidth/2-square.width/2;
        square.y = stage.stageHeight/2-square.height/2;
        square.addEventListener(TouchEvent.TOUCH_TAP, onTap);
    }
    public function onTap(e:TouchEvent):void
    {
        square.x -= 15;
    }
}

}

What is wrong?


Have you set your multi-touch input mode?

import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

I believe that is required for TouchEvents to be dispatched.

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜