Results 1 to 4 of 4
  1. #1

    rewriting array data?

    okay so i have this code:

    Code:
    myArray = new Array();
    
    for (i=0; i<items; i++) {
       //bunch of XML stuff
       myArray.push(0);
    }
    
    //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?

    thanks!

    d

  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:

    Code:
    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

    d

Similar Threads

  1. Loading LoadVars Data as Array Elements
    By RopeGun in forum ActionScript 2 (and Earlier)
    Replies: 0
    Last Post: April 15th, 2005, 02:03 PM
  2. PHP/MySQL assoc array, pulling data
    By nobody in forum Server-Side (PHP, SQL, ASP.NET, etc.)
    Replies: 1
    Last Post: March 6th, 2005, 07:43 PM
  3. Load array of data into fmx 2004
    By pixelisfun in forum ActionScript 2 (and Earlier)
    Replies: 0
    Last Post: February 2nd, 2005, 02:36 PM
  4. Loading data from sor into an array???
    By Boondogger in forum Game/AI Programming
    Replies: 4
    Last Post: June 17th, 2004, 05:57 PM
  5. Multidimensional array (Flash MX)
    By silverType in forum ActionScript 2 (and Earlier)
    Replies: 5
    Last Post: March 17th, 2003, 07:39 AM

Bookmarks

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

 Credits

Copyright 1999 - 2012