# Stop frame on loading?

**URL:** <https://forum.kirupa.com/t/stop-frame-on-loading/306199>\
**Category:** flash\
**Created:** [March 11, 2010, 4:19am UTC](https://forum.kirupa.com/t/stop-frame-on-loading/306199 "2010-03-11T04:19:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grimmsta](https://avatars.discourse-cdn.com/v4/letter/g/b5a626/32.png) [@grimmsta](https://forum.kirupa.com/u/grimmsta)\
**Post date:** [March 11, 2010, 4:19am UTC](https://forum.kirupa.com/t/stop-frame-on-loading/306199/1 "2010-03-11T04:19:31Z")

</div>

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:

```auto

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 ☹

Any ideas?
