Results 1 to 4 of 4
Thread: rewriting array data?
-
May 11th, 2005, 11:56 AM #1
rewriting array data?
okay so i have this code:
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'.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 }
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
-
May 11th, 2005, 12:30 PM #2
-
May 11th, 2005, 01:27 PM #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; } }
-
May 11th, 2005, 01:38 PM #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
-
Loading LoadVars Data as Array Elements
By RopeGun in forum ActionScript 2 (and Earlier)Replies: 0Last Post: April 15th, 2005, 02:03 PM -
PHP/MySQL assoc array, pulling data
By nobody in forum Server-Side (PHP, SQL, ASP.NET, etc.)Replies: 1Last Post: March 6th, 2005, 07:43 PM -
Load array of data into fmx 2004
By pixelisfun in forum ActionScript 2 (and Earlier)Replies: 0Last Post: February 2nd, 2005, 02:36 PM -
Loading data from sor into an array???
By Boondogger in forum Game/AI ProgrammingReplies: 4Last Post: June 17th, 2004, 05:57 PM -
Multidimensional array (Flash MX)
By silverType in forum ActionScript 2 (and Earlier)Replies: 5Last Post: March 17th, 2003, 07:39 AM

Reply With Quote



Bookmarks