Hi all, after several unsuccessful attempts to create a function for this on my own I’m swallowing my pride and asking for help…
I have multiple movieclips (ml1, ml2, ml3 and ml4) to which I attach various clips out of the library to. Each movieclip uses a switch statemtent then attaches the appropriate movieclip from the library… so I got thinking, why can’t I do a function rather than all this scripting? And I must have had a really long weekend because whatever I try just isn’t working.
Here’s my code at the moment…
switch (supp1) {
case "bu" :
mlid = "Budweg Logo";
break;
case "ro" :
mlid = "Roulunds Logo";
break;
case "td" :
mlid = "Bremtech Hydraulics";
break;
case "hpm" :
mlid = "Bremtech Friction";
break;
case "" :
mlid = "";
break;
}
ml1.attachMovie(mlid, "ml1", 10);
switch (supp2) {
case "bu" :
mlid = "Budweg Logo";
break;
case "ro" :
mlid = "Roulunds Logo";
break;
case "td" :
mlid = "Bremtech Hydraulics";
break;
case "hpm" :
mlid = "Bremtech Friction";
break;
case "" :
mlid = "";
break;
}
ml2.attachMovie(mlid, "ml2", 10);
etc...
and here is the function I came up with (that doesn’t work)… so any help on this would be greatly appreciated. Thanks.
function attachLogo(n) {
switch (supp+n) {
case "bu" :
mlid = "Budweg Logo";
break;
case "td" :
mlid = "Bremtech Hydraulics";
break;
case "ro" :
mlid = "Roulunds Logo";
break;
case "hpm" :
mlid = "Bremtech Friction";
break;
case "na" :
mlid = "Bremtech Friction";
break;
case "" :
mlid = "";
break;
}
ml+n.attachMovie(mlid, "ml+n", 10);
}
attachLogo(1);
attachLogo(2);
attachLogo(3);
attachLogo(4);