maguskrool
Technical User
Hi.
The website I'm currently working on has an object gallery. Whenever the user clicks one of the objects, it zooms in and displays a sub-gallery with other images of said object. The images that make up these galleries are loaded into dynamically created empty MovieClips inside a sub-gallery MovieClip. Each object has a varying number of images and they're loaded and unloaded when the zooming in/out of the object ends.
When you click one of the sub-gallery images, the main image should change and display the clicked image. However, I'm having trouble telling the MovieClips containing the sub-gallery images to do anything when they're clicked. See attached code, please.
I'm guessing this has to do with the onRelease being declared inside the onMotionFinished. The thing is I can't thing of a way to declare the onRelease for every sub-gallery image before they're loaded.
Thanks in advance.
The website I'm currently working on has an object gallery. Whenever the user clicks one of the objects, it zooms in and displays a sub-gallery with other images of said object. The images that make up these galleries are loaded into dynamically created empty MovieClips inside a sub-gallery MovieClip. Each object has a varying number of images and they're loaded and unloaded when the zooming in/out of the object ends.
When you click one of the sub-gallery images, the main image should change and display the clicked image. However, I'm having trouble telling the MovieClips containing the sub-gallery images to do anything when they're clicked. See attached code, please.
I'm guessing this has to do with the onRelease being declared inside the onMotionFinished. The thing is I can't thing of a way to declare the onRelease for every sub-gallery image before they're loaded.
Thanks in advance.
Code:
//Variables
var raiz:MovieClip = this;
var mclGalleryLoader:MovieClipLoader = new MovieClipLoader();
//Listener
oListenerYScale.onMotionFinished = function() {
//Number of images for this object
for (var i = 0; i<totalImages; i++) {
raiz.mcGallery.createEmptyMovieClip("mcImg"+i, raiz.mcGallery.getNextHighestDepth());
raiz.mclGalleryLoader.loadClip("images/"+(i+1)+".jpg", raiz.mcGallery["mcImg"+i]);
raiz.mcGallery["mcImg"+i].onRelease = function() {
trace("clicked me");
}
};