Ns.onMetaData within class function?

hi there,

I am trying this function in a class, but i can only trace duration A and not duration B


public function playVideo():Void {
		if(!isStarted) {
		theVideo.attachVideo(ns);
		ns.play(videoURL);
		isStarted = true;
		} else {
		ns.pause();
		}
		//duration
		ns.onMetaData = function(obj) {
			this.duration = obj.duration;
			trace(" Duration A:"+duration);
		}
		trace("Duration B: "+this.duration);
trace("Duration B: "+duration);
		//call videostatus with our netstream
		videoInterval = setInterval(videoStatus, 100, ns, duration);
		_root.playBtn._visible = false;
		_root.pauseBtn._visible = true;
	}

Any tips?