开发者

what is difference between sprite.width VS sprite.scaleX

Both of sprite.width and sprite.sc开发者_运维百科aleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?


When you change the width property, the scaleX property changes accordingly

var rect:Shape = new Shape();
rect.graphics.beginFill(0xFF0000);
rect.graphics.drawRect(0, 0, 100, 100);
trace(rect.scaleX) // 1;
rect.width = 200;
trace(rect.scaleX) // 2;

official documentation


You should read the official documentation about scaleX and width.

By default, scaleX=1 which means there is no rescaling of the sprite, it does not depend on anything, you may set it freely.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜