This content has been marked as final. Show 3 replies
First something that doesn't answer your question and something that does. Here is a little trick. The createEmptyMovieClip method returns a reference to the newly create clip so your code could be written:
//and so on…
But now I see two problems. First the one you have mentioned. As you are noticing, that you are putting "j" inside the onRelease handler. But that is a reference to "j" not the actual value of it. So when the onRelease handler is called later, its value is the last value because it is the current value of "j." So basically you need to do what you have suggested (see you knew the answer and didn't even know it!) in your post. You need each clip to have its own ID. So you could put this kind of code right after you create the empty movie clip.
And then in the onRelease handler:
But this goes to the other problem which I think you will run into. When you load external resources into a clip the clip is "reset" to its default status once the contents are loaded in. So both the myID property and the onRelease handler will be erased when the button.jpg art is loaded into mc_back+j clip.
You might not have experienced this yet because you are in the testing environment or testing from your local machine, but if you will be trying this over the web you will eventually run into this problem.
So here is what I might suggest. Create your mc_back+j movieclips.
Assign the myID and onRelease to the mc_back+j clip.
Inside each of the mc_backs create a clip called "art" or some such.
Load the external jpg into the art clip.
this is a great answer! it works fine.
i didn't have the problem you noticed with settings wich would be reset to default when loading the jpg, because I did not use the jpg (just by example). instead of this, I use a movieclip filler wich give something to click on...
thanks, it was really helpful
Great, don't forget my trick. If _root["mc_back"+r+j] was created using createEmptyMovieClip() you could use the returned reference to "tidy" up the drawing code. Just me, but I've always found curClip is much easier to type correctly than _root["mc_back"+r+j] is! :)