0

我在另一个电影剪辑中有一个视频。当我进入全屏时,我会放大外部影片剪辑以适应屏幕。这样 OuterMovieClip.width 就等于 screenWidth 等。如何保持视频的纵横比不失真?什么是正确的数学?

谢谢你。

4

1 回答 1

2

我相信你需要一些东西(下面的代码未经测试)......

var screen_aspect_ratio = Screen.Width / Screen.Height;
var outer_aspect_ratio = OuterMovieClip.Width / OuterMovieClip.Height;
var new_outer_width;
var new_outer_height;

if (screen_aspect_ratio > outer_aspect_ratio) {
  new_outer_height = Screen.Height;
  new_outer_width = (Screen.Height * OuterMovieClip.Width) / OuterMovieClip.Height;
} else {
  new_outer_width = Screen.Width;
  new_outer_height = (Screen.Width * OuterMovieClip.Height) / OuterMovieClip.Width;
}

OuterMovieClip.Width = new_outer_width;
OuterMovieClip.Height = new_outer_height;
于 2010-01-20T21:42:24.867 回答