为什么这个精灵会缩放?

发布于 2024-12-13 12:22:28 字数 859 浏览 0 评论 0原文

这是一个非常简单的 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); 
    }
}
}

:

500x500的屏幕截图,后面我的全屏宽度为1280

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); 
    }
}
}

:

Screenshot of 500x500, with my full screen width of 1280 behind

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘初心 2024-12-20 12:22:28

不知何故,您的 Flash 播放器的缩放模式设置在 FlashBuilder 中设置为奇怪的模式。

尝试

stage.scaleMode = StageScaleMode.NO_SCALE;

在 stageHandler 函数中进行设置。您的代码没有错误。问题出在您的发布预览设置中。

Somehow your scalemode settigns for your flash player are set in a strange mode from FlashBuilder.

Try setting

stage.scaleMode = StageScaleMode.NO_SCALE;

in your stageHandler function. You code has no errors. The problem is in your publish preview settings somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文