はじめましてkohimotoと申します。
flvのBitmapData.darwについて質問させてください。
ステージ上にmy_videoという空のvideoを配置して
下記のようなスクリプトを書きました。
import flash.display.BitmapData;
var img:BitmapData;
this.createEmptyMovieClip("bit_mc", 1);//attachBitmap用MC
var FLVfile:String = "*****.flv";//読み込むflvファイル
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play(FLVfile);
stream_ns.onMetaData = function(meta_info:Object) {
//ステージに配置したvideoをリサイズ&サイズを変数に
w = my_video._width = meta_info.width;
h = my_video._height = meta_info.height;
//↓オリジナルvideoの下にのbit_mcを配置
bit_mc._x = 10;
bit_mc._y = h + my_video._y + 10;
init();
};
function init():Void {
//↓取得したvideoサイズでBitmapDataを作ってonEnterFrameでdrawを開始
img = new BitmapData(w, h);
bit_mc.onEnterFrame = function(){
img.draw(my_video);
//trace(img.width + "-" + img.height);
this.attachBitmap(img, 1);
}
}
なぜかdrawされたサイズが小さいです。
(デフォルトのvideoサイズ160*120になっています。)
img.draw(my_video);の下のtrace(img.width + "-" + img.height);
では正常なサイズ(読み込んだflvのサイズ==new BitmapData()で作ったサイズ)になっています。
img.draw(my_video, new Matrix(a = w / 160, b = 0, c = 0, d = h / 120, tx = 0, ty = 0), new ColorTransform(), "normal", img.rectangle, true);
とすればオリジナルと同じサイズになりますが、こういうものなのか、それともscriptがまちがっているのか、分かりません。
どなたかご教授ください。よろしくお願いします。