Skip to main content
Jul 19, 2011 3:37 PM UTC
Answered

Touch equivalent of mouseX?

Is there something like tapX or touchX I tried all combinations I could think of the top of my head and did some searching but nothing comes up.

Any ideas?

This topic is closed to new replies. Start a new post to keep the conversation going.
boat5Correct answer
Inspiring
Jul 20, 2011 2:32 AM UTC

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBegin);

function touchBegin(e:TouchEvent):void {
    ball.x = e.stageX;
    ball.y = e.stageY;

    //or depending on the situation
    //ball.x=e.localX;
    //ball.y=e.localY;
}

3 replies

boat5Correct answer
Inspiring
Jul 20, 2011 2:32 AM UTC

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBegin);

function touchBegin(e:TouchEvent):void {
    ball.x = e.stageX;
    ball.y = e.stageY;

    //or depending on the situation
    //ball.x=e.localX;
    //ball.y=e.localY;
}

Translate
Jul 20, 2011 3:17 PM UTC

Awesome, havent tried it yet but I am sure it will be just what I need.

Thank you so much!!!

Translate