UIComponent's width and height have no effect on Sprite
Give开发者_开发百科n this code:
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFFCC00);
circle.graphics.drawCircle(0, 0, 20);
var uiComp:UIComponent = new UIComponent();
uiComp.x = 100;
uiComp.y = 100;
uiComp.measuredHeight = 0;
uiComp.measuredWidth = 0;
uiComp.addChild(circle);
addChild(uiComp);
Why does changing the width and height of uiComp not affect the Sprite? Wouldn't UIComponent provide Sprite with a Graphics object, which limits that area where Sprite can draw?
As I said in the other thread, use unscaledWidth
and unscaledHeight
as the bounds for drawing.
精彩评论