1 Reply Latest reply on Mar 21, 2008 5:22 AM by Newsgroup_User

    Arrays in Custom Classes

    dwsprouse
      The class below is in a document called (Node.as)

      class Node {
      private var _z = new Array();
      public function Node(z) {
      this._z[0] = z;
      }
      function getz(index) {
      return this._z[index];
      }
      }

      This is the actionscript of the main document

      import Node;
      //create line placeholders
      var node0:Node = new Node(234);
      trace(node0.getz(0));
      var node1:Node = new Node(345);
      trace(node0.getz(0));
      var node2:Node = new Node(786);
      trace(node0.getz(0));

      Why does the trace yield completely different numbers?????