Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu won't work correctly in IE7 1

Status
Not open for further replies.

bwilch

Technical User
May 5, 2003
627
US
Greets. I've created a menu in Flash 8 AS2 which gives a list of 11 options. Click 1-11 and it opens a MC which contains buttons. The MC is then ._visible and .enable = true When another option is clicked, or the same option is clicked, the current MC is closed ._visible and .enable = false and the new one is opened. It works great in FF, however, in IE 7, it's hiding the MC, but not disabling them. Below is the AS I'm using. btn# is the primary button clicked which then opens btnMenu# (side note, I know I can do something else with the individual btn#.onRelease I just haven't gotten that far yet :)

Thank you!

Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var startX:Number = btnMenu1._x;

var i = 0;

//Currently the tweens are not functioning on closemenu.  Reason is hidemenu is disabling/visibling false
//before the tween can finish, making them disappear.  This could be fixed at a later time.
closemenu = function (param, onoff) {
	temp= eval("btnMenu"+param);
	new Tween(this["btnMenu"+param],"_alpha",Regular.easeOut,100,0,12,false);
	new Tween(this["btnMenu"+param],"_x",Regular.easeOut,temp._x,temp._x-10,12,false);
	hidemenu(param)
	return 0;
}
//This function disables the MC that holds the buttons and makes them invisible.  This turns off the clicking
//of the buttons as well as keeps the buttons from interfearing with other buttons. ie overlapping.
hidemenu = function (param) {
		temp = eval("btnMenu"+param);
		temp.enabled = false;
		temp._visible = false;
		trace (param)
}
//Call the hidemenu function to keep the buttons from appearing initially.
onLoad = function (){
for (y=1;y<12;y++){
	try{
	hidemenu(y);
	}
	catch (e:Error){
	}
}

}
openmenu = function(param)
{
	temp = eval("btnMenu"+param);
	new Tween(temp,"_alpha",Reglar.easeOut,0,100,12,false);
	new Tween(temp,"_x",Regular.easeOut,temp._x,temp._x+10,12,false);	
	temp.enabled = true;
	temp._visible = true;
	return param;
}

btn1.onRelease= function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 1) i = openmenu(1);
		else i = 0;
	}
btn2.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 2) i = openmenu(2);
		else i = 0;
	}
btn3.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 3) i = openmenu(3);
		else i = 0;
	}
btn4.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 4) i = openmenu(4);
		else i = 0;
	}
btn5.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 5) i = openmenu(5);
		else i = 0;
	}
btn6.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 6) i = openmenu(6);
		else i = 0;
	}
btn7.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 7) i = openmenu(7);
		else i = 0;
	}
btn8.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 8) i = openmenu(8);
		else i = 0;
	}
btn9.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 9) i = openmenu(9);
		else i = 0;
	}
btn10.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 10) i = openmenu(10);
		else i = 0;
	}
btn11.onRelease = function () 
	{
		if (i != 0) closemenu(i,false);
		if (i != 11) i = openmenu(11);
		else i = 0;
	}
 
Addt'l information. It appears for some reason it's not running the "onload" function of .enabled = false The buttons are not visible, but I can still mouse over them to see them there. Also, if I go through and turn on every btn# then turn them off, it functions correctly. Still works fine as a stand alone flash (ie using flash player, no IE) and in FF, but in IE, it's still annoying me. :D
 
If you set the property "enabled" of a MovieClip to false, it will disable the MovieClip as a button. i.e. events such as [tt]MovieClip.onPress[/tt] etc will be ignored. This is nothing to do with a Button inside the MovieClip - the Button will not be disabled even if you disable the MovieClip. In order to disable the Button inside a MovieClip, you need to do explicitly: [tt]MovieClip.Button.enabled = false;[/tt]

(But may be you're talking about something else here...!)

Kenneth Kawamoto
 
It appears that the buttons within the MC will be disabled and go invisible with the MC control .enabled and ._visible

When I click on btnMenu1, the MC shows and activates the buttons within it. When I click it again, the MC hides and deactivates the buttons.

It's my initial onLoad call that doesn't appear to be working correctly. All of the menus are hidden, but the buttons are still present until I click on all of the btnx's
 
> It appears that the buttons within the MC will be disabled and go invisible with the MC control .enabled and ._visible

Ah, "_visible" - sorry I was talking about "_alpha". Yes "_visible" completely hides MovieClip. In fact "enabled" has nothing to do with the Button inside, you won't need it if you're using "_visible".

Anyway, looking at your code:
Code:
onLoad = function (){
for (y=1;y<12;y++){
    try{
    hidemenu(y);
    }
    catch (e:Error){
    }
}

}

hidemenu = function (param) {
        temp = eval("btnMenu"+param);
        temp.enabled = false;
        temp._visible = false;
        trace (param)
}
looks a bit weird to me. I would do like this:
Code:
// AS2
for (y=1; y<12; y++) {
	hidemenu(y);
}

function hidemenu(param:Number):Void {
	this["btnMenu"+param]._visible = false;
	trace(param);
}

Kenneth Kawamoto
 
Ah, you're correct on the ._visible, I checked one of my references and it indicates it also disables at the same time.

I think I see the error in my way. I was using "onLoad" thinking it would run that command when the .swf was loaded. By doing so though it wasn't running correctly. I made the change you suggested and it's now working as intended.

Thanks so much for your help, I really do appreciate it, this was starting to dive me nuts. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top