开发者

UIComponent's width and height have no effect on Sprite

开发者 https://www.devze.com 2022-12-09 01:02 出处:网络
Give开发者_开发百科n this code: var circle:Sprite = new Sprite(); circle.graphics.beginFill(0xFFCC00);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消