[flash8] Issues with getting the duration from a NetStream object

I’m loading a .flv file with the NetStream object within a class. I’m trying to get the duration of the video through the onMetaData event but I can’t seem to take that information out of the function (if I try to access the data or trace the value I get undefined).

import mx.utils.Delegate;
import caurina.transitions.Tweener;

class PresentationSlideshow.VideoPlayer.VideoScaffold extends MovieClip {

	private var _stageWidth:Number = Stage.width;
	private var _stageHeight:Number = Stage.height;
	private var _ncConnection:NetConnection;
	private var _nsStream:NetStream;
	private var _flv_mc:MovieClip;
	private var _audio_sound:Sound;
	private var _isPlaying:Boolean = true;
	private var _isMuted:Boolean = false;
	private var _videoDuration:Number = 0;
	public function VideoScaffold(path:String, vWidth:Number, vHeight:Number){
		buildScaffold(path, vWidth, vHeight);
		_root.movieContainer._alpha = 100; //this needs to be replaced with proper fade in code

	private function buildScaffold(path:String, vWidth:Number, vHeight:Number){
		// Create container for movie
		var movieContainer:MovieClip = _root.createEmptyMovieClip("movieContainer", _root.getNextHighestDepth());
		// Attach the video objct within the empty movie
		movieContainer.attachMovie("theVideo", "videoContainer", this.getNextHighestDepth());
		// Set the container so the video is in the exact middle of the screen
		movieContainer.videoContainer._width = vWidth;
		movieContainer.videoContainer._height = vHeight;
		movieContainer._x = (_stageWidth/2) - (vWidth/2);
		movieContainer._y = (_stageHeight/2) - (vHeight/2);
		movieContainer.attachMovie("videoControls", "videoControls", movieContainer.getNextHighestDepth());
		movieContainer.videoControls._x = (vWidth/2)-225;
		movieContainer.videoControls._y = vHeight + 40;
		// Makes everything invisible
		movieContainer._alpha = 0;

	private function loadVideo(path:String):Void{
		// get the video connected properly
		_ncConnection = new NetConnection();
		_nsStream = new NetStream(_ncConnection);
		// Attach the sound from the video to a new movie clip
		this.createEmptyMovieClip("flv_mc", this.getNextHighestDepth());
		var _audio_sound:Sound = new Sound(_flv_mc);
		// Get the duration of the video
		[COLOR="Red"]_nsStream.onMetaData = function(obj:Object) {
			_videoDuration = obj.duration;
		// Mute Button code
		var _isMuted:Boolean = false
		_root.movieContainer.videoControls.volumeButton.onRelease = function(){
			switch (_isMuted) {
				case false :
					trace("is false");
					_isMuted = true;
				case true :
					trace("is true");
					_isMuted = false;
		// Scrubber codde 
		_root.movieContainer.videoControls.slider.onPress = function(){
			this.startDrag(true, 75.5, 19.2, 375.5, 19.2);
		_root.movieContainer.videoControls.slider.onReleaseOutside = _root.movieContainer.videoControls.slider.onRelease = function(){
		// Button uses the Delegate class to force the button to play in proper scope
		_root.movieContainer.videoControls.playPauseButton.onRelease = Delegate.create(this, playPauseEvent);

	private function playPauseEvent():Void {
		switch (_isPlaying) {
			case true :
				_isPlaying = false;
			case false :
				_isPlaying = true;

I’m creating a video scrubber and I need the duration value to make it work. Any ideas?