For a website I’m making, I am creating a dynamic slideshow. Right now I’m creating thumbnails that display a small version of the image they correspond to. However, I’m having trouble loading the images dynamically into said thumbnails. My script is as follows:
_root
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]var[/COLOR] images:[COLOR=#0000FF]Array[/COLOR] = [COLOR=#000000][[/COLOR][COLOR=#FF0000]“http://www.example.com/image1.jpg”[/COLOR], [COLOR=#FF0000]“http://www.example.com/image2.jpg”[/COLOR][COLOR=#000000]][/COLOR];
[/LEFT]
[/FONT]
thumbnail_holder (all the mc’s for the thumbs are in here)
ActionScript Code:
[FONT=Courier New][LEFT]thumb1.[COLOR=#000080]image[/COLOR] = [COLOR=#0000FF]_root[/COLOR].[COLOR=#000080]images[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR];
thumb2.[COLOR=#000080]image[/COLOR] = [COLOR=#0000FF]_root[/COLOR].[COLOR=#000080]images[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR];
[/LEFT]
[/FONT]
thumb1, thumb2 (same mc, different instance name)
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]var[/COLOR] imageFrame:[COLOR=#0000FF]MovieClip[/COLOR] = [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“container”[/COLOR], [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]var[/COLOR] clipLoader:[COLOR=#0000FF]MovieClipLoader[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]MovieClipLoader[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] image = [COLOR=#0000FF]undefined[/COLOR];
[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]image !== [COLOR=#0000FF]undefined[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
clipLoader.[COLOR=#0000FF]loadClip[/COLOR][COLOR=#000000]([/COLOR]image, [COLOR=#FF0000]“container”[/COLOR][COLOR=#000000])[/COLOR];
imageFrame.[COLOR=#0000FF]_xscale[/COLOR] = [COLOR=#000080]14[/COLOR];
imageFrame.[COLOR=#0000FF]_yscale[/COLOR] = [COLOR=#000080]14[/COLOR];
frame.[COLOR=#0000FF]swapDepths[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]
Not that it matter, but frame is an MC that is a border around the image. Anyway, I’ve tested loading images into the thumb by replacing image with a URL, which worked, but when I try to get the variables from the _root to the thumbnail, it doesn’t work. What am I doing wrong?