PDA

View Full Version : Maintaining Function results


jimmyjames
01-27-2002, 07:15 PM
How do you call a function several times with different arguments, and maintain the values of each call without it overriding the values of the previous result? For instance, lets say I have two MCs 'circle' and 'square' with two buttons along with my function on the _root:

function duplicateMC (clipX, name, depth) {
clipX.duplicateMovieClip(name, depth);
}

and I have two different movie clips I'd like to duplicate with two different buttons with these function calls on each:

button 1:
on (release) {
duplicateMC (circle, "circle1", 5);
}

button 2:
on (release) {
duplicateMC (square, "square1", 5);
}

The point to my question is this: I dont want the button 2 duplication to overwrite the button one duplication, which it does now. Maybe I can give the function a unique ID or something?

Also, this is an oversimplification of my project, actually the duplication function I have written is for text and will duplicate many letters in lines of a poem, and set them to different animations. I want to do this with a function, because this script is fairly long, and I want to reuse it.

I am a beginner scripter, and any help on this would be greatly appreciated!

jimmyjames
01-27-2002, 09:36 PM
Hey all,
This is jimmyjames, I realized my error in setting the depths to the same value. Sorry if I have wasted anyone's time.
jj