为什么这个精灵会缩放?
这是一个非常简单的 AS3 项目,由一个绘制矩形的类组成。当我运行它时,矩形明显大于 100x100 像素。拔掉我的头发几个小时后,我想我应该问:为什么?
编辑:我知道这是不正确的,因为虽然我将屏幕分辨率设置为 1280x800,但如果我将宽度设置为 500,它几乎会占据我的整个屏幕。
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Draw extends Sprite
{
private var screen:Sprite;
public function Draw():void
{
this.addEventListener(Event.ADDED_TO_STAGE, stageHandler);
}
private function stageHandler(e:Event):void{
screen = new Sprite();
screen.graphics.clear();
screen.graphics.beginFill(0x333333,.9);
screen.graphics.drawRect(0,0,100, 100);
screen.graphics.endFill();
addChild(screen);
trace(stage.width + "," + stage.height);
}
}
}
:
Here's a very simple AS3 project consisting of one class which draws a rectangle. When I run it, the rectangle is clearly larger than 100x100 pixels. After pulling out my hair for a few hours I thought I'd ask: why?
Edit: I know that it isn't correct because, though I have my screen resolution set to 1280x800, if I set the width to 500 it takes up almost all of my screen.
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Draw extends Sprite
{
private var screen:Sprite;
public function Draw():void
{
this.addEventListener(Event.ADDED_TO_STAGE, stageHandler);
}
private function stageHandler(e:Event):void{
screen = new Sprite();
screen.graphics.clear();
screen.graphics.beginFill(0x333333,.9);
screen.graphics.drawRect(0,0,100, 100);
screen.graphics.endFill();
addChild(screen);
trace(stage.width + "," + stage.height);
}
}
}
:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知何故,您的 Flash 播放器的缩放模式设置在 FlashBuilder 中设置为奇怪的模式。
尝试
在 stageHandler 函数中进行设置。您的代码没有错误。问题出在您的发布预览设置中。
Somehow your scalemode settigns for your flash player are set in a strange mode from FlashBuilder.
Try setting
in your stageHandler function. You code has no errors. The problem is in your publish preview settings somewhere.