Navigation class with ON state

Hello,
This is my first attempt at writing a class, so be gentle (-:
I have used this navigation script several times in regular flash coding without problems (as in functions). Now I’m trying to put this code in a class for easier usage in future projects.

Concept of the code is that I pass the instance of the mc in an variable so that I have an old and new location for enabling and disabling a “ON” state in an mc (vars : OldLocation && NewLocation).
This is pretty basic stuff but I can’t get it to work inside a class…

Offcourse at the first click you will get an undefined because of no instance defined yet (I define it in the fla file).

Does anyone knows why I can’t rewrite the var OldLocation ?

My code :


class ButtonClass extends MovieClip {
	
	public var OldLocation;
	public var NewLocation;
	
	public function ButtonClass() {
		this.onRollOver = this.over;
		this.onRollOut  = this.out;
		this.onRelease  = this.doAction;
	}
	
	private function over()  { this.gotoAndPlay(2); }
	private function out ()  { this.gotoAndPlay(7); }
	
	private function doAction() {
		SmartNavi(this);
	}
	
	public function SmartNavi(item) {
		NewLocation = item;
		
		trace ("OldLocation = " + OldLocation);
		trace ("NewLocation = " + NewLocation);
		
		OldLocation.enabled = true; // Reset old location state
		OldLocation.gotoAndPlay(7); // Reset old location
		
		NewLocation.enabled = false; // Disable new location
		NewLocation.gotoAndStop(6); // Set new state
// !!! Here's the problem !!!
		OldLocation = NewLocation;	// Keep in mind
	}

}

Regards,
Kenny