0

(私は Actionscript を初めて使用します。これが簡単な質問でしたら申し訳ありません。)

私は Actionscript でメディア プレーヤーを実行しており、次のクラス階層があります。

  • メイン クラス、スプライトを拡張し、含む
    • VideoPlayer クラス、Sprite を拡張、Video オブジェクトを含み、Netstream を使用してビデオをロード

ビデオ プレーヤーは、さまざまなサイズのコンテナーを使用して、さまざまなアプリケーションに埋め込まれます。(html/swfobject で定義されているように) 親コンテナーのサイズに応じてビデオ プレーヤーのサイズを変更する方法はありますか?

Main クラスの「scaleMode」プロパティで遊んで、コンテナに応じてフラッシュ オブジェクトを再スケーリングすることができましたが、ビデオのサイズは常に同じです。

さらに、ビデオ クリップのメタデータを使用して、ビデオ オブジェクトの「幅」と「高さ」のプロパティを手動および自動で変更しましたが、ビデオのサイズが間違っているようです。ビデオのサイズを swfobject のサイズに合わせると、320x240 よりもはるかに小さくレンダリングされます。

助けてくれてありがとう。

4

1 に答える 1

0

このようなことを試してください

// get the video aspect ratio
// 1.33 (4/3)  | 640 x 480
// 1.77 (16/9) | 854 x 480
//trace(_video_width / _video_height);
videoAspectRatio    = _video_width / _video_height;

// check if video is larger than stage
// check which is larger: height or width
// set video size as the largers of height or width

// if video is a 4/3 aspect ratio
if( videoAspectRatio  < 1.4)
{
    myVideo.width   = _stageWidth / videoAspectRatio;   
    myVideo.height  = myVideo.width / videoAspectRatio;

    // if movie is still to small to the stage make it bigger
    if(myVideo.height < _stageHeight)
    {
            myVideo.width = myVideo.width * (_stageHeight/myVideo.height);
            myVideo.height = _stageHeight
    }
}
else
{
    myVideo.width   = _stageWidth;
    myVideo.height  = _stageWidth / videoAspectRatio;
}
于 2012-05-18T14:03:03.087 に答える