All variables start offset by 1 (a=1, b+2, c+3, etc…)
I want the values to all start over when they reach 7.
You can see the lower half of code displays these images, basically rotating around a circle.
What is most efficient way to script? I assume an array.
a += 1; if (a==7) {a=1};
b += 1; if (b==7) {b=1};
c += 1; if (c==7) {c=1};
d += 1; if (d==7) {d=1};
e += 1; if (e==7) {e=1};
f += 1; if (f==7) {f=1};
loadmovie(“menus/MenuImg” + a + “.jpg”,“MenuImg1”);
loadmovie(“menus/MenuImg” + b + “.jpg”,“MenuImg2”);
loadmovie(“menus/MenuImg” + c + “.jpg”,“MenuImg3”);
loadmovie(“menus/MenuImg” + d + “.jpg”,“MenuImg4”);
loadmovie(“menus/MenuImg” + e + “.jpg”,“MenuImg5”);
loadmovie(“menus/MenuImg” + f + “.jpg”,“MenuImg6”);
Please help? Thought it does work this way, I know I am far from proper/efficent in my scripting.
Thanks for quick reply. Ok, I didn’t think of declaring var in onLoad, I am doing it on _parent timeline (this is working). But I am going to move them to onLoad so they are visible there.
My question was more to do with optimizing the if = 7 part. I didn’t know if there was simpler notation to do the same thing for each variables increment and check.
function doNums(value) {
for (var i = 1; i<7; i++) {
loadMovie(value+i+".swf", "_root.empty");
}
}
You would call the function by doNums(“a”); which would load a1.swf to a6.swf - change *.swf to whatever and _root.empty to whatever, including the target to the mc.
You could use the same function but just use doNums(“b”); which would load b1.swf to b6.swf. Same for doNums(“c”); Just call the function with the correct target path and loop it. It would keep going from 1 to 6.
I declare a global because in under each movieclip I have an “on(release)”
which goes to an swf named in ffarray.
It is called by loadmovie(ffarray(_global.ffa)) etc…
And I might use it in other places also for titling effects, sounds, etc…
Also my code repeats every 100 frames. Do I want to increment ++ on every loadmovie?
I guess it looks like it would work, because next time I come around to the first loadmovie again, I should end up with one number higer than I did last time right?