2010-12-08 87 views
0

我正嘗試在遊戲庫中使用影片剪輯塊創建遊戲板。我的代碼是在鏈接ActionScript文件,看起來像這樣:AS3 - 不平衡堆棧?

package { 
import flash.display.*; 

public class Plethora extends MovieClip { 

     public function Plethora(): void { 
     var m:uint=200; 
     var n:uint=200; 
     var boardArray:Array = [[0, 1, 0], [0, 1, 0], [1, 0, 1]]; 
     for (var i:uint=0; i < 3; i++) { 
      for (var j:uint=0; j <3; j++) { 
       if (boardArray[i,j] == 1){ 
        var thisBlock: Block = new Block(); 
        thisBlock.stop(); 
        thisBlock.x = m; 
        thisBlock.y = n; 
        addChild(thisBlock); 
       } 
       m = m -50; 
      } 
      n = n - 50; 
     } 
    } 
} 
    } 

當我試運行它,我得到以下的輸出:

 
      verify Plethora$iinit() 
         stack: 
         scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ flash.display::MovieClip$ Plethora$] 
         locals: Plethora * * * * * * 
    0:getlocal0 
         stack: Plethora 
         scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ flash.display::MovieClip$ Plethora$] 
         locals: Plethora * * * * * * 
    1:pushscope 
         stack: 
         scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ flash.display::MovieClip$ Plethora$] Plethora 

... 

         locals: Plethora? uint uint Array? uint uint Block 
    136:findpropstrict addChild 
         stack: Array? Plethora 
         scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ 

我沒有絲毫的想法是什麼任何甚至可能開始意味着什麼。我會很感激一些關於如何開始調試的提示。

回答

3

Block Block MovieClip中可能存在一些奇怪的現象。你有什麼代碼嗎?此外,您的二維數組語法不正確:

boardArray[i, j] 

應該是:

boardArray[i][j] 

做出這樣的轉變我複製到精彩的代碼並運行它之後 - 這似乎很好地工作。 Have a look.

+2

+1。你說的是這裏的罪魁禍首。如果你想看看這個錯誤背後的一些血腥細節,請查看:http://stackoverflow.com/questions/4003286/error-1030-stack-depth-is-unbalanced/ – 2010-12-08 21:04:55