0 Replies Latest reply on Sep 26, 2008 11:44 AM by Urf

    Accessing an Array in a duplicated movie clip

    Urf Level 1
      I have a movie clip that has a script declaration of:
      var myCGroup:Array = Array();
      in the first frame.

      (I've also tried var myCGroup:Array; var myCGroup:Array = new Array(); and var myCGroup:Array = []; )

      I duplicate this movie clip multiple times. I'm having trouble targeting the variable myCGroup from elsewhere in the timeline. Other non-array variables that are declared in the same place are fully accessible.

      The only code I've been able to write that writes to this variable is:
      eval(targetThumb).myCGroup = prodFlush[2].childNodes;

      which actually takes the childnodes and creates an array with them.

      However, reading them back out from a separate function later is impossible:
      trace("colors to target =====" + eval(masterProds[sm]).myCGroup);
      returns nothing. I can read and write to other variables from the same function using the same targeting.

      (yes, materProds[sm] == targetThumb)

      Also, the following code results in an undefined array:

      // for(cg=0;cg<cGroupArray.length;cg++){
      // eval(targetThumb).myCGroup.push(cGroupArray[cg].firstChild.nodeValue);
      // trace("time: " + cg + " || adding this color group " + cGroupArray[cg].firstChild.nodeValue + " to product: "+ targetThumb + "===== " + eval(targetThumb).myCGroup)
      // };

      Is this a bug, or a documented local vs. global variable option that I'm unaware about regarding arrays?

      Any other thoughts? I'm at my wits end.

      Thanks in advance.

      -r