I'm trying to get the dimensions of the videosource in a 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);
}
}
But the result is always 0.
I got the same result with:
trace (vid.videoObject.videoWidth + " " + vid.videoObject.videoHeight);
Any other idea?
Thanks
Assuming its a mx.controls.VideoDisplay, once the video loads you should be able to use:
Without the videoObject in the middle.
You can also try listening for the ready event, which should fire on successful video load, instead of every time the state changes: