AS2 Components

Hello!

I am having a problem using AS2 components.

I am using swapDepths before removing movieclips, so I don’t think getNextHighestDepth is the issue.

The problems occur after running the following two functions. The first function “helpwin” displays a pop-up. The second function “hidewin” is called by a button on the pop-up. The problems then occur, but only after adding a component to the file.

//////////////////////////////////
// Popup dynamic window display //
//////////////////////////////////
function helpwin(wintitle, wintext, framenumber, jumpname) {
	_global.haltnumber = framenumber;
	_root.helptext = eval(wintext);
	if (_level0.helper) {_level0.helper.swapDepths(100); removeMovieClip(_level0.helper);}
	if (_level1.helper) {_level1.helper.swapDepths(100); removeMovieClip(_level1.helper);}
	if (_level2.helper) {_level2.helper.swapDepths(100); removeMovieClip(_level2.helper);}
	if (framenumber<35) {
		_root.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
		_root.helptext = eval(wintext);
		if (framenumber<=13) {
			i = 1;
			a = 0;
			b = 13;
		} else if (framenumber<=34) {
			i = framenumber;
			a = 24;
			b = 34;
		} else {
			i = framenumber;
			a = 0;
			b = 0;
			removeMovieClip(_root.helper);
		}
		if ((i>=a) and (i<b)) {
			do {
				_root.helper.gotoAndStop(i);
				left = _root.helper.ins_winText.maxscroll;
				i++;
			} while ((left>5) and (i<b));
			framenumber = i--;
		}
	}
	if (((_root._ymouse>300) and (_root._ymouse<600)) and ((_root._xmouse>0) and (_root._xmouse<800))) {
		switch (framenumber) {
		case 10 :
			ypos = -67;
			break;
		case 9 :
			ypos = -83;
			break;
		case 8 :
			ypos = -100;
			break;
		case 7 :
			ypos = -119;
			break;
		case 6 :
			ypos = -136;
			break;
		case 5 :
			ypos = -153;
			break;
		case 4 :
			ypos = -170;
			break;
		case 3 :
			ypos = -187;
			break;
		case 2 :
			ypos = -205;
			break;
		case 1 :
			ypos = -222;
			break;
		default :
			ypos = 0;
			break;
		}
	} else {
		if (((_root._ymouse>0) and (_root._ymouse<300)) and ((_root._xmouse>0) and (_root._xmouse<800))) {
			switch (framenumber) {
			case 1 :
				ypos = 225;
				break;
			case 2 :
				ypos = 209;
				break;
			case 3 :
				ypos = 190;
				break;
			case 4 :
				ypos = 174;
				break;
			case 5 :
				ypos = 157;
				break;
			case 6 :
				ypos = 139;
				break;
			case 7 :
				ypos = 120;
				break;
			case 8 :
				ypos = 102;
				break;
			case 9 :
				ypos = 86;
				break;
			case 10 :
				ypos = 68;
				break;
			default :
				ypos = 0;
				break;
			}
		} else {
			ypos = 0;
		}
	}
	if (framenumber<>40) {
		_global.wintitle = wintitle;
		_global.wintext = wintext;
		_global.framenumber = framenumber;
	}
	_global.jumpname = jumpname;
	if (_level0.helper) {_level0.helper.swapDepths(100); removeMovieClip(_level0.helper);}
	if (_level1.helper) {_level1.helper.swapDepths(100); removeMovieClip(_level1.helper);}
	if (_level2.helper) {_level2.helper.swapDepths(100); removeMovieClip(_level2.helper);}
	if (wintext.length>30) {
		if (_level2._visible) {
			_level2.helptext = wintext;
			trace(this.getNextHighestDepth());
			_level2.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
			_level2.helper.mainbar = wintitle;
			_level2.helper.gotoAndStop(framenumber);
			_level2.helper._x = 0;
			_level2.helper._y = ypos;
		} else {
			if (_level1._visible) {
				_level1.helptext = wintext;
				trace(this.getNextHighestDepth());
				_level1.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
				_level1.helper.mainbar = wintitle;
				_level2.helper.gotoAndStop(framenumber);
				_level1.helper._x = 0;
				_level1.helper._y = ypos;
			} else {
				_level0.helptext = wintext;
				trace(this.getNextHighestDepth());
				_level0.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
				_level0.helper.mainbar = _global.wintitle;
				_level0.helper.gotoAndStop(framenumber);
				_level0.helper._x = 0;
				_level0.helper._y = ypos;
			}
		}
	} else {
		if (_level2._visible) {
			if (_level1._visible) {
				aaa = ("_level1."+wintext);
				tempdata = eval(aaa);
				_level2.helptext = tempdata;
			} else {
				aaa = ("_level0."+wintext);
				tempdata = eval(aaa);
				_level2.helptext = tempdata;
			}
			_level2.helptext = tempdata;
			trace(this.getNextHighestDepth());
			_level2.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
			_level2.helper.mainbar = wintitle;
			_level2.helper.gotoAndStop(framenumber);
			_level2.helper._x = 0;
			_level2.helper._y = ypos;
		} else {
			if (_level1._visible) {
				aaa = ("_level1."+wintext);
				tempdata = eval(aaa);
				_level1.helptext = tempdata;
				trace(this.getNextHighestDepth());
				_level1.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
				_level1.helper.mainbar = wintitle;
				_level1.helper.gotoAndStop(framenumber);
				_level1.helper._x = 0;
				_level1.helper._y = ypos;
			} else {
				aaa = ("_level0."+wintext);
				tempdata = eval(aaa);
				_level0.helptext = tempdata;
				trace(this.getNextHighestDepth());
				_level0.attachMovie("thehelpwin", "helper", this.getNextHighestDepth());
				_level0.helper.mainbar = wintitle;
				_level0.helper.gotoAndStop(framenumber);
				_level0.helper._x = 0;
				_level0.helper._y = ypos;
			}
		}
	}
	if (framenumber>14) {
		if (_global.setfc ne undefined) {
			_root.pausetimer(1, "resetfocus()");
		}
	}
}
/////////////////////////////////
// Hide dynamic window display // 
/////////////////////////////////
function hidewin() {
	_global.haltnumber = 0;
	if (_level0.helper) {_level0.helper.swapDepths(100); removeMovieClip(_level0.helper);}
	if (_level1.helper) {_level1.helper.swapDepths(100); removeMovieClip(_level1.helper);}
	if (_level2.helper) {_level2.helper.swapDepths(100); removeMovieClip(_level2.helper);}
	switch (_global.jumpname) {
	case 1 :
		// jump to next chapter
		jumpinlp(_global.cursecnum);
		break;
	case 99 :
		// jump to next page
		if (_level1._visible) {
			_level1.nextpage();
		} else {
			if (_level2._visible) {
				_level0.nextpage();
			} else {
				_level0.nextFrame();
			}
		}
		break;
	case undefined :
		// do nothing, just hide popup
		break;
	case 0 :
		// do nothing, just hide popup
		break;
	default :
		if (_global.jumpname>100) {
			_global.jumpname = _global.jumpname-100;
			if (_level1._visible eq true) {
				section = "\\"+_global.curlesson+"\\"+_global.curlesson+"_"+"s"+_global.jumpname+".swf";
				_level1.curframe = "1";
			} else {
				section = _global.curlesson+"_"+"s"+_global.jumpname+".swf";
				_level0.curframe = "1";
			}
			//			loadMovieNum(section, 2);
			mcLoader.loadClip(section, 2);
		} else {
			// jump to selected chapter
			jumpinlp(_global.jumpname);
		}
		break;
	}
	if (_global.setfc ne undefined) {
		_root.pausetimer(1, "resetfocus()");
	}
	_global.jumpname = 0;
}

Specifically the problems are:

The “over” state for the button on the pop-up only appears when the mouse is moving. It is possible to click the button, but take a few tries.

After the pop-up has been removed, several other buttons will only execute the “press” event… NOT the “release” event.

Somehow, the component is interfering…

Any help (or theory) on what’s going on would be greatly appreciated!