mouseUp unreliable on iOS (see code)
About half the time, I find buttons using the code below get stuck in the "down" state. There is no relible factor - sometimes the MOUSE_UP works and sometimes it doesn't. What am I doing wrong here?? (This is on iOS, BTW)
Any thoughts?
---------------------------------------
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
public class buttons extends MovieClip {
public function buttons()
{
this.gotoAndStop(1);
this.addEventListener(MouseEvent.MOUSE_DOWN, downPress);
this.mouseChildren = false;
}
private function downPress(event:MouseEvent):void
{
//frame 4 in my button mc holds the down btn graphic
this.gotoAndStop(4);
this.addEventListener(MouseEvent.MOUSE_UP, upChuck);
this.addEventListener(MouseEvent.MOUSE_OUT, rollingOut);
this.removeEventListener(MouseEvent.MOUSE_DOWN, downPress);
}
private function rollingOut(event:MouseEvent):void
{
this.gotoAndStop(1);
this.addEventListener(MouseEvent.MOUSE_DOWN, downPress);
this.removeEventListener(MouseEvent.MOUSE_OUT, rollingOut);
this.removeEventListener(MouseEvent.MOUSE_UP, upChuck);
}
private function upChuck(event:MouseEvent):void
{
this.gotoAndStop(1);
this.removeEventListener(MouseEvent.MOUSE_UP, upChuck);
this.removeEventListener(MouseEvent.MOUSE_OUT, rollingOut);
this.addEventListener(MouseEvent.MOUSE_DOWN, downPress);
trace("up");
}
}
}
