3 Replies Latest reply on Jun 23, 2012 9:02 AM by kglad

    Why will this code only trace strings?

    witherton

      The following code randomizes the array "doors". It works fine if the array is strings. However,

      if I remove the quotation marks, it traces "[object Symbol1_1]" instead.

       

      var doors:Array = [red_button, blue_button,yellow_button];

      var randomDoors:Array = new Array(doors.length);

       

      var randomPos:Number = 0;

      for (var i:int = 0; i < randomDoors.length; i++)

      {

          randomPos = int(Math.random() * doors.length);

          randomDoors[i] = doors.splice(randomPos, 1)[0]; 

      }

      trace (randomDoors);

       

      Tracing (randomDoors.name) returns the  statement "undefined". How can I trace "doors" without converting the elements to strings?