我仍在学会用AS3号法规,这似乎很直截了当,类似于Java,因此,如果我where误了某些地方的话,我会抱歉。
根据问题标题,我正试图制作一个2D(封顶)系列的电影剪辑,我已经制作,以便按以下方式印制。
var NumCols:Number = 8;
var NumRows:Number = 8;
var ColWidth:Number = (stage.stageWidth-8)/NumCols;
var ColHeight:Number = (stage.stageWidth-8)/NumRows;
var GemMatrix:Array = new Array( 8, 8 );
var n = 1;
var SW:Number = stage.stageWidth;
var SH:Number = stage.stageHeight;
private function GJ_GenerateBoard(event:MouseEvent):void {
// Initialization...
for (var j = 0; j < NumRows; ++j)
{
GemMatrix[y] = [];
for (var i = 0; i < NumCols; ++i)
{
trace(i,j);
GemMatrix[i][j] = new Gem() as MovieClip;
this.addChild(GemMatrix[i][j]);
GemMatrix[i][j].x = i*ColWidth+ColWidth/2;
GemMatrix[i][j].y = j*ColHeight+ColHeight/2;
}
}
我收到的错误是:
ReferenceError: Error #1056: Cannot create property 0 on Number.
在我试图创建新的Gem(Gem()案时,情况就是如此。
Any help is greatly appreciated. Thanks!