I’m making an array and populating it with a for loop. I have no problem doing this with a movieclip from the library, but when I attempt to use a Sprite called OneMillion instead using the same script I keep getting the message:
1180: Call to a possibly undefined method OneMillion.
Here’s the code and it works perfectly if I use a movieclip linked from the library:
var arrayCount:Number=1000;
var loopCount:Number=1000;
var numRows:Number=132;
var numColumns:Number=200;
var hSpace:Number=1.25;
var vSpace:Number=4.75;
var deficitScreen:Sprite=new Sprite();
deficitScreen.x=30;
deficitScreen.y=30;
addChild(deficitScreen);
deficitScreen.rotation=-90;
var OneMillion:Sprite=new Sprite();
OneMillion.graphics.beginFill(0x990000);
OneMillion.graphics.drawRect(0,0,1,3);
var aMillions:Array=new Array();
makeArray();
function makeArray():void {
for (var i:Number=0; i<1000; i++) {
var currentRow:int=Math.floor(i/numColumns);
var currentColumn:int=i-(currentRow*numColumns);
aMillions*=new OneMillion();
deficitScreen.addChild(aMillions*);
aMillions*.x=currentColumn*hSpace;
aMillions*.y=currentRow*vSpace;
aMillions*.alpha=1;
//trace(aMillions.length);
}
}