16 Replies Latest reply on Jun 12, 2007 6:04 AM by kglad

    function not seeing array

    SurgicalSteel Level 1
      hey all,
      ok, i have an array declared as a field variable in an .as file called scaleArray, i declare it like this:

      var scaleArray:Array = new Array();

      in the field variable area of my class file. when i use the following function, everything is hunky dory:

      function loadScale(scale:String) {
      var loadScale = new LoadVars();
      var tmp:Array = new Array();
      loadScale.onLoad = function(success) {
      if (success) {
      var temp:Array = this.steps.split(",");
      for (var a:Number = 0; a<temp.length; a++) {
      tmp[a] = parseInt(temp[a]);
      scaleArray = tmp.slice();

      the scaleArray traces out with all the right data. but when i go to use this function (only ever after the previous function has executed):

      function makeHalfStepMelody() {
      if (melody[0].scalePos>0) {
      for (var a:Number = 0; a<melody[0].scalePos; a++) {
      halfStepMelody[0] += scaleArray[wrapScale(a)];

      the trace at the top of the function comes out blank, as if scaleArray is empty. any help would be immensely appreciated. this has had my progress stopped for a couple days. thanks.