缩放 Flash 中的图像以匹配 html 中定义的大小

发布于 2024-07-11 07:46:55 字数 455 浏览 11 评论 0原文

我有一个 Flash 影片,可以从 xml 文件动态加载图像。 我想在不同页面上重复使用此 .swf 文件,但是第 1 页上的图像均为 400 x 200,第 2 页上的图像均为 745 x 422。当我尝试在另一个页面上重复使用此文件时,加载的图像会缩小(调整大小)-我希望它们匹配宽度/高度中定义的内容,但它们会根据舞台的缩放方式进行缩放。

我使用加载器(AS3)作为将它们放置在容器(精灵)上的图像,

slideLoader.load(new URLRequest(xmlSlideshow..image[intCurrentSlide].@src));

我尝试过使舞台大小不同来启动,但我真的希望它尽可能无关紧要 - 即:50 x 50。 html 的宽度/高度将设置为正在加载的图像的宽度/高度。

我不是闪存向导,所以如果我不清楚,请原谅我,如果需要,我会尽力提供更多见解。

I have a flash movie that loads images dynamically from an xml file. I want to re-use this .swf file on different pages, however the images on page1 are all 400 x 200 and the images on page2 are all 745 x 422. When i try to reuse this on another page, the loaded images are shrunken (resized) - i would like them to match whats defined in the width/height, but they get scaled depending on how the stage is scaled.

im using a loader (AS3) for the image that places them on a container(sprite)

slideLoader.load(new URLRequest(xmlSlideshow..image[intCurrentSlide].@src));

I have tried making the stage various sizes to start, but i would really like it to be irrelavant if possible - ie: 50 x 50. Then in html the width/height would be set to the width/height of the images being loaded.

Im not a flash wizard so please forgive me if im not clear, i'll try to give more insight if needed.

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

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

发布评论

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

评论(3

分開簡單 2024-07-18 07:46:56

抱歉,我手头没有代码,但我知道您可以选择在启动时在画布上设置不调整大小。

理想情况下,您可以通过嵌入标签的属性传入高度/宽度,在画布上不调整大小并使用传入的尺寸来设置图像尺寸。

I apologize I don't have the code at hand, but I know you have the option to set a no-resize on the canvas at startup.

Ideally, you can pass in the height/width via the attributes of the embed tag, have a no resize on the canvas and use the passed in dimensions to set your image dimenions.

心凉 2024-07-18 07:46:56

我相信就是这样:

fscommand("allowscale","false");

I believe this is it:

fscommand("allowscale","false");
音栖息无 2024-07-18 07:46:55

有几件事......首先,您需要指定您的应用程序不可扩展。 (AS3 代码)

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

然后,一旦加载图像(向 SlideLoader 对象添加侦听器),就使用 flash 的ExternalInterface 类执行 javascript 函数。

ExternalInterface.call('resizeFlashMovie', slideLoader.width, slideLoader.height);

你的 javascript 函数将是这样的:

function resizeFlashMovie(width, height) {
    var flash = document.getElementById('yourFlashMovieId');
    flash.style.width = width+'px';
    flash.style.height = height+'px';
}

Couple of things... firstly you'll need to specify your app not to scale. (AS3 code)

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

Then once your image is loaded (add a listener to the slideLoader object), execute a javascript function using flash's ExternalInterface class.

ExternalInterface.call('resizeFlashMovie', slideLoader.width, slideLoader.height);

And your javascript function would be something like this:

function resizeFlashMovie(width, height) {
    var flash = document.getElementById('yourFlashMovieId');
    flash.style.width = width+'px';
    flash.style.height = height+'px';
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文