469,943 Members | 2,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,943 developers. It's quick & easy.

I unload a flash file...but key presses from previous file are still active

My problem is that I'm wrestling to make the LoadMovie and UnloadMovie functions work for me. Here is the layout of my flash file: I've got several seperate flash files and I can jump to any one of them by pressing a specific key to load another flash file. Here is the code I'm using for this bit:

keylistener = new Object();
keylistener.onKeyDown = function() {
if (Key.getAscii() == 51)
loadMovie("tap.swf", "_level1");
};
Key.addListener(keylistener);
Now when the next flash file is loaded, I use this bit of code to get rid of the previous flash file.

unloadMovie("_level0");
Now this does work in getting rid of the previous flash file in a visual sense; it dissapears, but the code still remains active. See, I have several other keypress functions in each flash file, so I need to disable/remove/unload the programmed keypresses of the previous scene. Because at the moment I'm getting stuff like this: I'll press a key and move from flash file "tip" to flash file "top," but then I press the Q key, which is meant to make a character pop up in the flash file "top," but it ends up taking me back to the flash file "tip," because that also has coding attached to the Q key.

Phew, hopes this makes sense. I've found out that people can get around this problem when working with buttons and making the buttons disabled...but can you do a similar thing with key presses? Is there perhaps another way to open flash files in the time line other than the LoadMovie code?

Oh, and I'm working in Flash MX Professional 2004

Cheers,
Kyle
Sep 15 '07 #1
1 2259
All is well, I found a solution on another forum!
Odd, but it seems that unloadMovie("_level1"); has problems that unloadMovieNum(1); doesn't.
Although it seems I have to be careful not to unload level 0 - if you unload that everything dissapears!
Sep 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

40 posts views Thread by googler | last post: by
1 post views Thread by Mariella Bakker | last post: by
reply views Thread by fblake | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.