如何使基于 Netstream 的 Actionscript 视频播放器自动调整大小以匹配父级大小?
(我是 Actionscript 的新手,如果这是一个简单的问题,我很抱歉。)
我正在 Actionscript 中做一个媒体播放器,我有以下类层次结构:
- 主类,扩展 Sprite,并包含
- VideoPlayer 类,扩展 Sprite,包含一个 Video 对象并使用 Netstream 加载视频
视频播放器将嵌入到具有不同大小容器的不同应用程序中。有没有办法让视频播放器根据父容器的大小(如 html / swfobject 中定义)调整大小?
我使用了 Main 类上的“scaleMode”属性,并设法使 Flash 对象根据容器重新缩放,但视频始终具有相同的大小。
此外,我使用视频剪辑的元数据手动和自动更改了视频对象的“宽度”和“高度”属性,并且视频尺寸似乎是错误的 - 我有一个 320x240 的 swfobject,当我更改视频的大小与 swfobject 大小相匹配,它呈现的大小比 320x240 小得多。
预先感谢您的帮助。
(I am new to Actionscript and I am sorry if this is a simple question.)
I am doing a media player in Actionscript and I have the following class hierarchy:
- Main class, extends Sprite, and contains
- VideoPlayer class, extends Sprite, contains a Video object and loads the videos using Netstream
The video player will be embedded in different applications with containers with different sizes. Is there a way to make the video player to resize according to the size of the parent container (as defined in the html / swfobject)?
I played with the "scaleMode" properties on the Main class and I managed to make the flash object to rescale according to the container, but the video has always the same size.
Additionally, I changed the "width" and "height" properties of the Video object, both manually and automatically using the metadata of the video clip, and the video dimensions seem to be wrong - I have a swfobject with 320x240 and when I changed the size of the video to match the swfobject size, it rendered much smaller than 320x240.
Thanks in advance for the help.
尝试这样的事情
try something like this