Load diferent jpegs using variables

Hey :slight_smile:
I have the same button several times in a loaded swf.
On release, I want this buttons to attach a “mcextra” into target x
This mcextra moves on vertical position and shows inside a jpeg.
How can I use the same code to all the buttons so I can attach the mcextra and load diferent jpeg images? I guess Ill have to set a variable calling the jpeg, isnt?

Thanks

Hi,
You probably need to write an array rather than set a var, tho difficult to say without seeing your file.
can you post an fla ?

SteveD

Hi,

Your post contradicts itself, but I am guessing that you want to dynamically load Jpegs into a movieclip that then scrolls vertically?

The easiest way would be to create a function that loads a jpeg into the “mcextra” clip.

loadmovie (pic, mcextra)

‘Pic’ would be the variable for the jpegs. Then to scroll it just manipulate the ‘mcextra._y’ value.

As for the buttons you just put,

onpress
pic=“jpegname.jpg”

Each button has a different pic value, depending on the jpeg, then call the function to load and scroll it.

Those are the basics, just look up tutorials on functions if you need more help.

Cheers.

Hey guys!
I got some help from a friend and we used the following solution.

In the first frame of the main timeline we created this function:

function loadextra (i) {
// here it attaches the mc into an empty mc
_root.attachextra.attachMovie(“mcextra”, “mcextra”, 1);
// here it sets the final Y position for the attached mc
_root.attachextra.posY = 400;
// here it loads the image into “loadimg” inside mc extra
_root.attachextra.mcextra.loadimg.loadMovie ( i + “.jpg”, 1);
}

On the button action we set:

on(release) {
// call the function and set the parameter to load the img
_root.loadextra(“art/images/img” + “01”);
}

Thanks for your help!
:slight_smile: