My program needs to be able to load an f4v, and then remove it after it finishes playing. However I can’t get the COMPLETE eventListener to do this - I get a ‘1120: Access of undefined property pose’ message at best.
Any ideas?
import fl.video.VideoEvent;
video.addEventListener(MouseEvent.MOUSE_UP, playVideo, false, 0, true);
function playVideo(evt:MouseEvent):void {
closeAll();
var vidConnection:NetConnection = new NetConnection();
vidConnection.connect(null);
var vidStream:NetStream=new NetStream(vidConnection);
vidStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
var pose:Video = new Video();
pose.width=1080;
pose.height=1920;
addChild(pose);
pose.attachNetStream(vidStream);
vidStream.play("poses/cold.f4v");
pose.addEventListener(VideoEvent.COMPLETE, noMoreVideo);
}
function noMoreVideo(evt:VideoEvent):void {
trace("done");
home.removeChild(pose);
}
function asyncErrorHandler(event:AsyncErrorEvent):void {
trace(event.text);
}