我收到错误
错误 #2099:加载对象未充分加载以提供此信息
当我尝试使用 as3corelib 将对象编码为 JSON 时。我成功地编码了一些没有父或子的值对象,所以我知道库可以工作,并且该问题可能与 addChild 或类似的东西有关。那只是猜测。
板像这样添加到阶段:
stage.addChild(board);
当我不将板添加到舞台并尝试对其进行序列化时,我会收到不同的错误:
undefined
at XML/http://adobe.com/AS3/2006/builtin::copy()
at global/describeTraits()
at global/avmplus::describeType()
at global/flash.utils::describeType()
...
板级:
public class Board extends Sprite
{
public var board:Array;
public var blockColor:uint = 0xE3E3E3;
public var blockLength:uint
public function Board(blockLength:uint)
{
super();
x = 0;
y = 0;
this.blockLength = blockLength;
//buttonMode = true;
// Setting up two dim array
board = new Array(10);
for (var k:int = 0; k < board.length; k++)
{
board[k] = new Array(10);
}
for (var i:int = 0; i < 10; ++i)
{
for(var j:int = 0; j < 10; ++j)
{
var block:Block = new Block(i*blockLength, j*blockLength);
board[i][j] = block;
this.addChild(block); // here I add children
block.drawBlock(blockLength, blockColor);
block.addEventListener(MouseEvent.CLICK, blockClicked);
}
}
}
....
}
}
这是 Block 的代码,实际上什么都没有。
public class Block extends Sprite
{
public var cos:int = 5; // test
public function Block(x:uint, y:uint)
{
...
}
public function drawBlock(length:uint, color:uint):void
{
...
}
}
任何线索为什么会这样?