|
-
multiple conditions in a "for loop" ?
Can you use multiple conditions in a for loop?
For example, I am trying to attach images 1-6 to a specific movieclip, and images 7-12 to another and so on.
So my logic was to do this:
for (i=1; i<=6; i++) {
container.attachMovie("thumb"+i,"thumb"+i+"_mc",i) ;
}
for (i=1: i>6 && i<13; i++) {
container2.attachMovie("thumb"+i,"thumb"+i+"_mc",i );
}
But it's not working. Ony the top loop works.
Can someone clarify how it should be done?
Katie
-
You could just use a single loop, and put the selection logic inside of it. Try a variation of this:
Code:
for (i=1; i <= 15; i++) {
if (i <= 6) {
container1.attachMovie ("thumb" + i, "thumb" + i + "_mc", i);
} else if (i <= 12) {
container2.attachMovie ("thumb" + i, "thumb" + i + "_mc", i);
} else {
containerN.attachMovie ("thumb" + i, "thumb" + i + "_mc", i);
}
}
I am determined to make better mistakes tomorrow.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|