A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] [AS2][CS3] looping gotoAndStop selecting the frame from an array

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

    resolved [RESOLVED] [AS2][CS3] looping gotoAndStop selecting the frame from an array

    No easy way to explain really but I will try my best
    What I am aiming to do is have my for loop to pair the counters with there currect from using gotoAndStop where the frame is specifed in the array

    Im sure its a silly mistake Im doing its been a year since I last did any actionscript so my memory is rather fuzzy, and sorry for the poor naming going on it does make sense to me and the system for naming works across my entire file

    The section is need to sort is below:

    Actionscript Code:
    for (a=1; a<13; a++){
        EuMa.eutc[a].gotoAndStop(eucit[a]);
    }

    my array is named eucit, my location for the counters is EuMa, each counter is named eutc[a] where a is the counter number.
    I have 12 counters in EuMa.

    I know the location is correct though a simple test
    Actionscript Code:
    EuMa.eutc1.gotoAndStop(eucit[0]);

    This will bring back the correct frame for counter 1.
    I also know its the correct frame though the trace function on the array itself.

    Hopefully this makes sence to someone
    Thanks
    Ben

    Trust my code, and not my english.

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    322
    Actionscript Code:
    var eucit:Array=new Array(2,4,1,5,6,3);

    for (a=1; a<=eucit.length; a++){
        this["EuMa"]["eutc"+a].gotoAndStop(eucit[a-1]);
    }


    marlopax

  3. #3
    Senior Wabbit
    Join Date
    Jul 2008
    Location
    Winchester, Uk
    Posts
    215
    Actionscript Code:
    for (a=1; a<13; a++){
        eucit.push(icons.splice(0, 1));
            this["EuMa"]["eutc"+a].gotoAndStop(eucit[a-1]);
    }

    I changed back to my origional for as it populates the array from another array, as there is a large selection of numbers in the first which are randomised then have a number taken away and moved in to seperate arrays for each area.
    Anyway
    Tested the gotoAndStop location is fine.
    The first section does not point to the correct location at the moment it is classed as indefined.

    I will test a few ideas out and post again if I find the solution

    Trust my code, and not my english.

  4. #4
    Senior Wabbit
    Join Date
    Jul 2008
    Location
    Winchester, Uk
    Posts
    215
    Fixed
    Final solution is

    Actionscript Code:
    for (a=1; a<13; a++){
        eucit.push(icons.splice(0, 1));
        EuMa["eutc"+a].gotoAndStop(eucit[a-1]);
    }

    Thanks marlopax for spotting my frame location mistake and your shot reminded me in the end

    Trust my code, and not my english.

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