Externally loaded .flv still on screen when stopped
I have successfully loaded an external looping video and stopped it using a keypress function that closes the ns and nc. However a still of the last viewed frame of my video is frozen on the screen and when I go to any other frame in the timeline it covers over the image in the new frame. Also when I go back to the timeline frame with the video a new instance of that video plays but you can still see the image of the old video on the screen. How do I totally remove the video?
Here is my code to call the video: No problems here I think.
---------------------
stop();
//Defining the video to import
var vid:Video = new Video(1280,720);
addChild(vid);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
vid.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
ns.client = listener;
ns.play("video1.flv");
Thanks for the reply, that worked great . I can play the video and when I go to another frame it completely unloads and removes. However when I go back to play that frame I get this error:
---------------
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at DPD_bug02_fla::MainTimeline/unloadSwitch()
at DPD_bug02_fla::MainTimeline/onStageKeyDown()
---------------
I'm pretty new to flash (obviously) and not familiar with what this means. I have 7 keyframes in my timeline.
Frame 01 has code in which I define what keypress goes to what frame and unload the video: