Stop frame on loading?

hey all,

I have a scene set up where a button randomly goes to 1 of 4 frames and executes some code

here is the code:



m1.addEventListener(Event.ENTER_FRAME,animate);
function animate(evt:Event):void
	{
		evt.target.x += 10;
		if (m1.hitTestObject(m2)) 
		{
			m1.removeEventListener(Event.ENTER_FRAME,animate);
			m2.addEventListener(Event.ENTER_FRAME,animate2);		
		}
	}
function animate2(evt1:Event):void 
	{
			evt1.target.x +=10
		}
}

I need a way that will stop this from executing until a key or the mouse it pressed. I tried just a simple stop();, but this didn’t work :frowning:

Any ideas?