mardi 26 mai 2015

Actionscript3 clearInterval is not working on TouchEvent.TOUCH_BEGIN

I have called a setInterval on TouchEvent.TOUCH_END and I want to clear it when ever screen is touched. Someone please help me. My code is bellow-

import fl.motion.MotionEvent;
import flash.display.MovieClip;
import flash.utils.*;


Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;



stage.addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
stage.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);

function onTouchBegin(evt:TouchEvent)
{
    clearInterval(MovieClip(root).myInterval);
}


function onTouchEnd(evt:TouchEvent)
{
    MovieClip(root).myInterval = setInterval(showTimer,1000);
}

function showTimer()
{
    trace("interval working");
}

Aucun commentaire:

Enregistrer un commentaire