Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 4 of 4

Thread: rewriting array data?

  1. #1

    rewriting array data?

    okay so i have this code:

    myArray = new Array();
    for (i=0; i<items; i++) {
       //bunch of XML stuff
    //sometime later...
    button.onRelease = function() {
       myArray[buttonID] = 1;
       trace(myArray);	//outputs :: 0,0,0,0,0...for however many items i have
    okay, so obviously there is stuff missing from my code b.c i dont feel like copying it all over. its basically an XML controlled style blog, and i'm trying to keep track of whether an entry is open (0), or closed (1), and those values are being stored in 'myArray'.

    my question is, why isnt that call to myArray overwriting the existing data? i know i have doen this before (maybe not in this fashion, but i know its possible). anyone know what im doing wrong?



  2. #2
    what is buttonID?

  3. #3
    its just a number that is being used to identify a button with that particular spot in the array. example:

    for (i=0; i<5; i++) {
       var myButton = this.mcContent["btn"+i];
       myButton.buttonID = i;
       myButton.onRelease = function() {
          myArray[this.buttonID] = 1;

  4. #4
    ahh nevermind...i figured it out...

    the buttonID variable was being stored on a different clip...just had to change the addressing to accomodate it


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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 About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012