Flash调整大小问题

发布于 2024-11-10 15:04:10 字数 612 浏览 2 评论 0原文

我正在构建一个 Flash 项目,旨在成为一个非常具有视觉吸引力的应用程序。为了实现这一目标,我希望使应用程序能够 100% 适应浏览器窗口的大小,并用具有视觉吸引力的图像和交互性来填充其内容。

我希望其中一些物体与舞台的特定一侧(例如左侧)保持一致的距离。这是我的代码,我用来在运行时和重新调整大小时将徽标保持在距应用程序左侧 100px 的位置:

import flash.events.Event;

var logo:Logo = new Logo();

stage.addEventListener(Event.RESIZE, resizeListener);

function resizeListener(e:Event):void {
  logo.x = 100;
}

logo.x = 100;
logo.y = stage.stageHeight / 2;
logo.width = logo.width / 2;
logo.height = logo.height / 2;

addChild(logo);

问题是,由于某种原因,徽标保留在原位,并且不保持不变调整应用程序大小时距舞台左侧的距离保持一致。有人可以帮我修改上面的代码,使徽标距左侧 100px 吗?

感谢您的帮助。

I am building a Flash project which is intended to be a very visually appealing application. In order to accomplish this, I am hoping to make the application fit to 100% size of the browser window and fill its contents with visually appealing images and interactivity.

Some of these objects I would like to maintain a consistent distance from a particular side of the stage, say, the left side. Here is my code I am using to keep a logo 100px from the left side of the application during run-time and re-size:

import flash.events.Event;

var logo:Logo = new Logo();

stage.addEventListener(Event.RESIZE, resizeListener);

function resizeListener(e:Event):void {
  logo.x = 100;
}

logo.x = 100;
logo.y = stage.stageHeight / 2;
logo.width = logo.width / 2;
logo.height = logo.height / 2;

addChild(logo);

The problem with this is, for some reason, the logo stays in the spot, and doesn't maintain a consistent distance from the left side of the stage when the application is re-sized. Could someone help me revise the above code to keep the logo 100px from the left side?

Thank you for your help.

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

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

发布评论

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

评论(1

背叛残局 2024-11-17 15:04:10

确保您已设置stagealignscaleMode

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

理想情况下,您可以通过文档类进行设置,如果您尝试从导入的 MovieClip 进行这些更改,则可能会出现安全问题。

此外,flash 调试播放器可能存在舞台对齐和缩放问题,而这些问题在实时浏览器测试中不会出现。

Make sure that you've set the stage's align and scaleMode.

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

Ideally you'd set this via the document class and there may be security issues if you try to make these changes from an imported MovieClip.

Also, the flash debugging player may have issues with stage alignment and scale that do not appear in live browser tests.

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