clearing a video frame the stage
I have a script that loads in an external flv file.
i can remove the instance of _video from the stage, however i cant seem to reference it properly in order to clear its NetStream.
Here's the code:
Code:
Quote:
package {
import flash.display.*;
import flash.net.*;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
public class MainStageDocCLass extends MovieClip {
private var _localConnection:LocalConnection;
public var myLoader:Loader = new Loader();
var nc:NetConnection = new NetConnection();
private var _video:Video = new Video(532,272);
public function MainStageDocCLass() {
try {
_localConnection = new LocalConnection;
_localConnection.connect( "sfgovChannel");
_localConnection.client = this;
} catch (err:Error) {/*NULL*/
}
loadHomeNav();
trace("MainStageDocCLass.as has loaded");
}
public function loadItems(clip:String, xpos:uint, ypos:uint):void {
var myLoader:Loader = new Loader();
addChild(myLoader);
myLoader.load(new URLRequest(clip));
myLoader.x = xpos;
myLoader.y = ypos;
}
public function loadVideo() {
loadItems("AgencyContent/OfficeContent/Topic1/SectionA/CloseMovieClip.swf", 0, 325);
addChild(_video);
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
function onStatusEvent(stat:Object):void {
trace(stat.info.code);
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object)
{
trace(meta.duration);
};
ns.client = meta;
_video.attachNetStream(ns);
ns.play("example.flv");
}
public function closeMovies() {
_video.clear();
nc.close();
removeChild(_video);
trace("closeMovies success");
}
}
}
im pretty sure i need to issue ns.close(); but i dont know how to access it from a different method.
ns.close(); gives me Access of undefined property ns