I am using Flash 8, AS2. I am inexperienced with programming, and realize I may be approaching my goal entirely wrong.

I am using a movie clip to represent a blip/button, that when hovered over with the mouse, triggers an infobox to appear. On the mouse rollout, I disable the visibility of the infobox, on the condition that a flag is set to false.

All of my code is within the blip movieclip. The problem I am having, is that I want the infobox to remain visible when the blip is clicked, which sets the flag to true, but my code is reacting as if the flag is undefined or maybe does not exist. For instance, on rollout, the infobox does not disappear as it should when the movieclip remains unclicked.

I know this has to be a simple problem, though I am a newbie and cannot figure it out. I trace the value of the flag variable and it comes back as undefined. All help is appreciated.

this is the code within the movieclip, the variable in question is at the top.
Code:
onClipEvent (enterFrame) {
	var flag:Boolean;
	
	this.onRollOver = function() {
		_root.infobox1._visible = true;
		setProperty(_root.infobox1, _x, getProperty(this, _x));
		setProperty(_root.infobox1, _y, getProperty(this, _y)-40);
		this.play();
		import blipTween;
		var tween1:blipTween = new blipTween(this);
		
		trace(flag.valueOf());
	};
	this.onRelease = function() {
		if (flag=false) {
			flag = true;
		}
	};
	this.onRollOut = function() {
		if (flag=false) {
			_root.infobox1._visible = false;
			import blipTween;
			var tween2:blipTween2 = new blipTween2(this);
			this.gotoAndStop(1);
		}
	};
}
Am I assigning the var incorrectly at the beginning? Am I referencing the variable incorrectly within the rollover/rollout functions? why does the trace tell me the flag is undefined if boolean variables default to false?