Question : Actionscript: Dynamically create empty movie clip within a scroll pane, attach JPEG to that dynamically created movie clip

I have a scrollpane.  I have many images I want to put in the scrollpane as thumbnails.  They need to be movie clips because I need to do stuff with them when the user clicks on them.  Like fades, alpha stuff, scaling, load another instance of that dynamically created movie clip into a different movie clip, etc.

So - can someone provide some example code of how to:

1 - Dynamically create a empty movie clip ("within" my scrollpane)
2 - Insert a JPEG into that dynamically created movie clip (from disk or URL, using loadmovie)

I would appreciate it if you could be very specific as well - but beggars can't be choosers.  Thanks in advance.

Answer : Actionscript: Dynamically create empty movie clip within a scroll pane, attach JPEG to that dynamically created movie clip

I've never actually used a scrollpane but I'm pretty sure if you name it 'myScrollpane' then this will work:

totalimages = 6;
for (i=0; i<=totalimages; i++){
monkey = myScrollpane.createEmptyMovieClip("imageHolder"+i, i+10, 0, 40*i, 40, 40);
monkey.loadMovie("http://www.yourdomain.com/images/image"+i+".jpg");
};

You can then do other stuff with monkey (or whatever name you choose!) such as:

monkey.onRelease = function(){
// do something funky
};
Random Solutions  
 
programming4us programming4us