I'm trying to make a card game. I have a card and a deck class. The card class works fine but the deck has a weird loop. Here's my code:
Actionscript Code:
public class Deck extends MovieClip
    {
        private var i:int;
       
        private var balls:Array = [1,2,3,4,5,7,8,10,11,12,13,14];
        private var angles:Array = [1,2,3,4,5,7,8,10,11,12,13,14];
        private var crosses:Array = [1,2,3,5,7,10,11,13,14];
        private var carpets:Array = [1,2,3,5,7,10,11,13,14];
        private var stars:Array = [1,2,3,4,5,8];
        private var whots:Array = [20,20,20,20,20];
       
        public var cardsOnDeck:Array = new Array();
       
        public function Deck() {
            var dCounter:int = 0;
           
            for(i=0;i<balls.length;i++){
                cardsOnDeck[dCounter] = new Card(balls[i],"ball");
                dCounter++;
            }
            for(i=0;i<angles.length;i++){
                cardsOnDeck[dCounter] = new Card(angles[i],"angle");
                dCounter++;
            }
            for(i=0;i<crosses.length;i++){
                cardsOnDeck[dCounter] = new Card(crosses[i],"cross");
                dCounter++;
            }
            for(i=0;i<carpets.length;i++){
                cardsOnDeck[dCounter] = new Card(carpets[i],"carpet");
                dCounter++;
            }
            for(i=0;i<stars.length;i++){
                cardsOnDeck[dCounter] = new Card(stars[i],"star");
                dCounter++;
            }
            for(i=0;i<whots.length;i++){
                cardsOnDeck[dCounter] = new Card(whots[i],"whot");
                dCounter++;
            }
           
            initializeCards();
           
            addEventListener(Event.ENTER_FRAME, control);
           
        }
       
        public function control(evt:Event):void {
           
        }
       
        private function initializeCards():void {
            var child:Card;    
            for(i=0;i<cardsOnDeck.length;i++){
                child = Card(cardsOnDeck[i]);
                addChild(child);
            }
        }
       
    }

I tried scraping the initializeCards() method and call the addChild in the constructor (i.e after each definition) but no dice. The method definitely runs well, because in the program I see the last/top card added to the stage... I just think it's somehow still doing something in the loop with the arrays I don't quite understand. Help? Thanks.