title: Add dynamic instances of MovieClips to an array
body: <p>I'm trying to add an instance of a MovieClip inside an array.
  Inside the House Class is a property called HouseObjects. Inside that array, I created a Comp and a Light class. MovieClips are dynamically placed on the stage, via linkage. The MovieClips also act as "toggle buttons." If the button state is ON, value is 1. If the button state if OFF, value is 0.</p>
  
  <p>If the value is 1, I am trying to add MovieClip instance inside the onList Array. Inside that array will be all the instances that have a button state ON.</p>
  
  <p>I created a property called objSelect.</p>
  
  <pre><code>var objSelect:Object;
  </code></pre>
  
  <p>That variable holds the currentTarget selected. I'm trying to pass it to <code>function trackItems</code> to either push/pop it in the onList array, based on the button status.</p>
  
  <p><strong>I receive an error for this line:
  onList.pop(objSelect);
  Incorrect number of arguments.  Expected no more than 0.</strong></p>
  
  <pre><code>     public class House extends MovieClip 
  
      {
  
          var HouseObjects:Array = new Array();
      var onList:Array = []; // instances added to this array that have a bstatus ON
          var power:int; // holds value of individual House Objects
          var bstate:int; // 0 or 1 (ON or OFF)
          var bstatus:int;
          var userInput:int; // stores user data (of selected data); 
          //holds value of e.currentTarget.power
  
          var currentPower:int; // stores current power
              var objSelect:Object;
  
          public function House() 
          {
          // Instances are MovieClip "toggle buttons"
          HouseObjects[0] = new Comp(); // creates instance of Comp 
          HouseObjects[1] = new Light(); // creates instance of Light 
          }
  
           function toggleClick(e:MouseEvent) {
              // go to appropriate frame
        if (e.currentTarget.currentFrame == 2)
         {
          e.currentTarget.gotoAndStop(3);
          e.currentTarget.bstate = 1;
         }
  
         if (e.currentTarget.currentFrame == 4)
         {
          e.currentTarget.gotoAndStop(1);
          e.currentTarget.bstate = 0;
         } 
  
            bstatus = e.currentTarget.bstate;
            objName = e.currentTarget.name;
  
          trackItems(objSelect, bstatus); 
  
  
    } // end of function toggle click
  
  
  
    function trackItems(objSelect:Object, bstatus:int):void 
    {
       if (bstatus == 0) {
          // remove objSelect from Array onList 
  
       } else if (bstatus == 1) {
          onList.push(objSelect);
          //add to Array onList       
       }   
  
   }
  
   // function called when user clicks on update button
   function updateStage():void
   {
      for (var i:int = 0; i&lt;=onList.length;i++) { 
      addChild(onList[i]);
      }
  
   }
  </code></pre>
  
  <p>}</p>