# loadMovieNum on hitTest

**URL:** <https://forum.kirupa.com/t/loadmovienum-on-hittest/320096>\
**Category:** flash\
**Created:** [March 14, 2011, 11:16am UTC](https://forum.kirupa.com/t/loadmovienum-on-hittest/320096 "2011-03-14T11:16:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jude](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@Jude](https://forum.kirupa.com/u/Jude)\
**Post date:** [March 14, 2011, 11:16am UTC](https://forum.kirupa.com/t/loadmovienum-on-hittest/320096/1 "2011-03-14T11:16:08Z")

</div>

Hi folks,

As a novice I’m going round in circles with a hitTest problem. I have a character moving around a maze picking up coins off the ground as it goes. When it hits a coin a new movie should be opened and is then closed from within itself. I am using the following script:

[FONT=Calibri][SIZE=3]//check if character has hit any of the coins and load the appropriate movie[/SIZE][/FONT]  
[SIZE=3][FONT=Calibri]switch (true) {[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]case maze\_char.hitTest (coin\_1st) :[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]trace (“hit 1st coin”);[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]loadMovieNum (“coin1.swf”, 2);[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]break;[/FONT][/SIZE]

[SIZE=3][FONT=Calibri]case maze\_char.hitTest (coin\_2nd) :[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]loadMovieNum (“coin2.swf”, 3);[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]break;[/FONT][/SIZE]

[SIZE=3][FONT=Calibri]case maze\_char.hitTest (coin\_3rd) :[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]loadMovieNum (“coin3.swf”, 4);[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]break;[/FONT][/SIZE]

[SIZE=3][FONT=Calibri]case maze\_char.hitTest (coin\_4th) :[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]loadMovieNum (“coin4.swf”, 5);[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]break;[/FONT][/SIZE]

[SIZE=3][FONT=Calibri]case maze\_char.hitTest (coin\_5th) :[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]loadMovieNum (“coin5.swf”, 6);[/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]break; [/FONT][/SIZE]  
[SIZE=3][FONT=Calibri]}[/FONT][/SIZE]  
Using a trace I can determine that the character has hit the coin, but for some reason the loadMovieNum doesn’t happen until the character moves back off the coin.

I would be grateful if anybody had any ideas what I’m doing wrong.

J
