例如 mx.controls.Image 对象仅在我将它们直接添加到主应用程序对象时才会显示。如果我向先前创建的 Image 对象添加“子图像”,它根本不会显示。为什么 ?我错过了什么概念?
我想做的事:
var img : Image = new Image;
var subimg : Image = new Image;
img.source = "images/panel.png";
subimg.source = "images/panel.png";
subimg.x = 10;
subimg.y = 10;
addChild (img);
img.addChild(subimg); // img is displayed, but not the overlapping subimg
好的,这里的代码是如何通过直接将 subimg 添加到应用程序中的,就像 img 一样 - 这个当然有效:
var img : Image = new Image;
var subimg : Image = new Image;
img.source = "images/panel.png";
subimg.source = "images/panel.png";
subimg.x = 10;
subimg.y = 10;
addChild (img);
addChild(subimg); // img & subimg is displayed correctly