A Flash Developer Resource Site

1. ## [AS2][CS3] Multiple Loops

what I need to do is simple enough and it works well almost

This is a working copy of what I need to do So it works out which ones need to start on and off

Under the code i have explained the parts and below that is what I am aiming to achieve.

Actionscript Code:
`tval = Math.round(((ptsM[plaCon])*10)+5);for (b=1; b<=5; b++){    if (b+"1" < tval){        //bidHD["bid"+b+"1"] These are to start normally        trace (bidHD["bid"+b+"1"]+" this should show");    }else{        //These should start grey out bidHD["bid"+b+"1"]        trace (_root.bidHD["bid"+b+"1"]+" this should not show");    }}`

ptsM is my array the values follow [1,1,2,2,3,3,3,4,4,4,5,5,5,5,5,5];
bidHD - Is the parent MC
bid+b+c - are the children - C will be explained in a sec

This works well but I need it to work for 1,2 and 3
The above example works for this but is bulky.

The aim is a double for loops
Actionscript Code:
`tval = Math.round(((ptsM[plaCon])*10)+5);for (b=1; b<=5; b++){    for (c=1; c<=3; c++){        if (b+c < tval){            trace (_root.bidHD["bid"+b+c]+" this should show");        }else{            trace (_root.bidHD["bid"+b+c]+" this should not show");        }    }}`
The issue with the above is it picks b+c as a math equation so b=1, c=1 so its 2 which makes not what I want, I need 11 which is what the trace _root.bidHD["bid"+b+c] understands.  Reply With Quote

2. Try changing 'b+c' to 'String(b)+c', which should fix the problem.  Reply With Quote

array, loop, math, trace, vars #### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap 