var rec1:Shape = new Shape();
var rec2:Shape = new Shape();
var rec3:Shape = new Shape();
var spriteOnDisplayList:Sprite = new Sprite();
var spriteNotOnDisplayList:Sprite = new Sprite();
var spriteOnMainClass:Sprite = new Sprite();
spriteOnDisplayList.addChild(rec1);
spriteNotOnDisplayList.addChild(rec2);
spriteOnMainClass.addChild(rec3);
stage.addChild(spriteOnDisplayList);
//stage.addChild(spriteNotOnDisplayList);
this.addChild(spriteOnMainClass);
trace(rec1.root); //[object Stage]
trace(rec2.root); //null
trace(rec3.root); //[object MainTimeline]
一個display物件在它的constructor中, 其parent, root, stage等instance variable都是null值.
因為它尚未加入display list.
沒有留言:
張貼留言