It's saying that somewhere in your code, you're tying to use a Loader object where a MovieClip object should be. Skimming through your code, I see two places where you've casted an object to use as a Movieclip (where a Loader would not work). Try tracing out event.target
at those spots to see if it is a MovieClip object or the Loader object you have within.
If it shows the loader object, it's probably what is causing the error. Try changing event.target
to event.currentTarget
.
The way I understand the difference is event.target
is usually the object you clicked on (the Loader object within the MovieClip object), while event.currentTarget
is the object that is processing the event that has the event listener, which is the MovieClip you're after in this case.
(Anyone, feel free to correct me if I'm wrong)
As a side note, if you're using the Flash IDE, you can also press 'control + shift + enter' (instead of just control + enter) to use the debugger for testing, which usually can show you the exact line that gave the error as well.