如何在HTML页面中调整SWF大小?

时间:2022-01-31 21:13:01

The stageHeight and stageWidth are read-write properties of the Stage class.

stageHeight和stageWidth是Stage类的读写属性。

Is there any way to embed the swf so that when you set them to a different value, this is reflected in the HTML page? Possibly without calling a JS function via ExternalInterface to modify the embed's parameters?

是否有任何方法可以嵌入swf,以便在将它们设置为不同的值时,这会反映在HTML页面中?可能没有通过ExternalInterface调用JS函数来修改embed的参数?

The main idea is that I don't know what size my swf will be. I'm loading a video inside it and I want to resize the swf to match the size of the video.

主要的想法是我不知道我的瑞士法郎的大小。我正在其中加载视频,我想调整swf的大小以匹配视频的大小。

3 个解决方案

#1


We use http://code.google.com/p/swfobject/ which allows for auto resizing in addition to some other nice features.

我们使用http://code.google.com/p/swfobject/,除了一些其他不错的功能外,还允许自动调整大小。

#2


Your definitely going to need to call a JS function, the good news is it's really simple code, something like this:

你肯定需要调用一个JS函数,好消息是它的代码非常简单,如下所示:

function resizeIt(height)
{
      document.getElementById("myDiv").height = height;
}

Using SWFObject in this case you can set the width and height to be 100%, so it'll resize with the containing DIV, so you're not modifying the embed paramerters, but just the css.

在这种情况下使用SWFObject,您可以将宽度和高度设置为100%,因此它将使用包含DIV进行调整大小,因此您不会修改嵌入参数,而只是修改css。

#3


To my knowledge you can't do that. I can't actually fiddle around with it, 'cause i currently don't have access to flash.

据我所知,你做不到。我实际上无法摆弄它,因为我目前无法访问闪存。

It could work if you would insert the swf into a div, or whatever, that's "too big" for it in the first place, and then just try and resize it. What are you using to embed the swf, the basic thingie offered by the Flash IDE or something else, like swfobject?

如果你将swf插入一个div,或者其他任何东西,它首先是“太大”,然后只是尝试调整它的大小。你还用什么来嵌入swf,这是Flash IDE提供的基本东西,比如swfobject?

I don't know, you might have to actually use ExternalInterface or something like that to get the job done. And if it's not terribly important to work the player into your web layout, i would just implement the whole thing in the flash movie.

我不知道,你可能不得不实际使用ExternalInterface或类似的东西来完成工作。如果将播放器放入您的网页布局并不是非常重要,我只会在flash电影中实现整个内容。

#1


We use http://code.google.com/p/swfobject/ which allows for auto resizing in addition to some other nice features.

我们使用http://code.google.com/p/swfobject/,除了一些其他不错的功能外,还允许自动调整大小。

#2


Your definitely going to need to call a JS function, the good news is it's really simple code, something like this:

你肯定需要调用一个JS函数,好消息是它的代码非常简单,如下所示:

function resizeIt(height)
{
      document.getElementById("myDiv").height = height;
}

Using SWFObject in this case you can set the width and height to be 100%, so it'll resize with the containing DIV, so you're not modifying the embed paramerters, but just the css.

在这种情况下使用SWFObject,您可以将宽度和高度设置为100%,因此它将使用包含DIV进行调整大小,因此您不会修改嵌入参数,而只是修改css。

#3


To my knowledge you can't do that. I can't actually fiddle around with it, 'cause i currently don't have access to flash.

据我所知,你做不到。我实际上无法摆弄它,因为我目前无法访问闪存。

It could work if you would insert the swf into a div, or whatever, that's "too big" for it in the first place, and then just try and resize it. What are you using to embed the swf, the basic thingie offered by the Flash IDE or something else, like swfobject?

如果你将swf插入一个div,或者其他任何东西,它首先是“太大”,然后只是尝试调整它的大小。你还用什么来嵌入swf,这是Flash IDE提供的基本东西,比如swfobject?

I don't know, you might have to actually use ExternalInterface or something like that to get the job done. And if it's not terribly important to work the player into your web layout, i would just implement the whole thing in the flash movie.

我不知道,你可能不得不实际使用ExternalInterface或类似的东西来完成工作。如果将播放器放入您的网页布局并不是非常重要,我只会在flash电影中实现整个内容。