我試圖讓videosource的尺寸中的VideoDisplay:得到視頻的尺寸中的VideoDisplay
private function loadMovie() : void {
vid = new VideoDisplay();
vid.source = _item.itemLg;
vid.play();
vid.addEventListener (MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, onVideoPlay);
addElement(vid);
}
private function onVideoPlay (event : MediaPlayerStateChangeEvent) : void {
if (event.state == MediaPlayerState.PLAYING) {
trace (vid.videoObject.width + " " + vid.videoObject.height);
}
}
但結果始終爲0
我得到了相同的結果有:
trace (vid.videoObject.videoWidth + " " + vid.videoObject.videoHeight);
還有其他想法嗎?
感謝
我正在使用spark.components.VideoDisplay。與mx.controls.VideoDisplay我得到的錯誤:'錯誤:1000:無法建立連接到服務器或找到服務器上的FLV.' – icke
我也嘗試VideoEvent.READY,但我不明白它 '私人函數loadMovie():void { \t vid = new VideoDisplay(); \t vid.source = _item.itemLg; \t vid.addEventListener(mx.events.VideoEvent.READY,onVideoReady); \t addElement(vid); } \t \t \t 私有函數onVideoReady(事件:mx.events.VideoEvent):無效{ 跟蹤(vid.videoObject.videoWidth + 「」 + vid.videoObject.videoHeight); vid.play(); }' – icke