I’m still having some problems understanding these touch events…or maybe something else…can anyone enlighten me as to what i’m doing wrong in this code?? Only left as1&2 to go to 3 recently so I’m sure I have bad habits and misconceptions but…
In the IDE i have a button on the stage called: “touchBtn”
and a textfield called “timer”
the problem i have is that if i touch the button fast / lots, the display rate really slows down…I know this is down to something I’m doing totally wrong but not sure what…
all help and ridicule appreciated.
tinyflea
package {
import flash.display.MovieClip;
import flash.events.TouchEvent;
import flash.events.Event;
import flash.utils.*;
public class dotty extends MovieClip {
public function dotty() {
touchBtn.addEventListener(TouchEvent.TOUCH_BEGIN, TouchBegin);
touchBtn.addEventListener(TouchEvent.TOUCH_END, TouchEnd);
var theTime:int = 0;
var Ypos:int=0;
function TouchBegin(event:TouchEvent):void{
Ypos=mouseY;
}
function TouchEnd(event:TouchEvent):void{
Ypos=mouseY;
}
addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
theTime=getTimer();
timer.text=String(theTime);
}
}
}
}