A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [AS2][CS3] Multiple Loops

  1. #1
    Senior Wabbit
    Join Date
    Jul 2008
    Location
    Winchester, Uk
    Posts
    215

    Question [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.

    Hopefully that made sense. :P

    Trust my code, and not my english.

  2. #2
    Member
    Join Date
    Jan 2011
    Posts
    32
    Try changing 'b+c' to 'String(b)+c', which should fix the problem.

Tags for this Thread

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center