i have this working in another project but in this new one i’m getting errors. i put a video player on the stage:
function showVideo() {
trace(“showVideo”);
var videoHolder:video_holder = new video_holder();
videoHolder.name="videoholder";
videoHolder.x=392;
videoHolder.y=300;
addChild(videoHolder);
}
i have functions to remove the video player and to also close the stream(or the video audio continues). i can remove the video fine but when trying to close the stream i get this error twice(once for each of the lines below noted with ( //ERROR HERE). Does anyone have any idea why this is or how i can close the video stream?
1119: Access of possibly undefined property stream through a reference with static type flash.display:DisplayObject.
function removeVideo() {
if (Boolean(getChildByName("videoholder"))) {
trace("removeVideo");
var doremove:DisplayObject=getChildByName("videoholder");
//check if video stream exist. if so remove it
if (doremove.stream) { //ERROR HERE
doremove.stream.close(); //ERROR HERE
}
deleteVideo();
}
}
function deleteVideo() {
trace(“deleteVideo”);
var doremove:DisplayObject=getChildByName(“videoholder”);
var doIndex:int=getChildIndex(doremove);
removeChildAt(doIndex);//
}