Identical buttons. Some work some don't. Help!

Hi,

I’ve got a load of AS on a layer. It operates 7 movie clips as buttons with a boolean value.

Each of the 7 buttons has AS for it. The code is identical everytime, with the obvious changes for the relevant movie clip.

4 work, 2 never work, and 1 works every now and again. Does anyone have any idea what the problem could be?

I’ve put an example of code that does work below, followed by code that doesn’t work. There are 7 examples of this code in the same frame.

This one does work.


red_mc.onRelease = function(){
	if (spinning){
		loop_mc._visible = false;
		loop_mc.stop();
		red1_mc._visible = true;
		red1_mc.gotoAndPlay(2);
		red_mc._visible = true;
		red_mc.gotoAndPlay("redbutton1");
		green_mc.gotoAndPlay("greenbutton3");
		blue_mc.gotoAndPlay("bluebutton3");
		yellow_mc.gotoAndPlay("yellowbutton3");
		orange_mc.gotoAndPlay("orangebutton3");
		purple_mc.gotoAndPlay("purplebutton3");
		lilac_mc.gotoAndPlay("lilacbutton3");
		spinning = false;
	}else{
		red_mc.gotoAndPlay("redbutton2");
		purple_mc.gotoAndPlay("purplebutton4");
		blue_mc.gotoAndPlay("bluebutton4");
		green_mc.gotoAndPlay("greenbutton4");
		yellow_mc.gotoAndPlay("yellowbutton4");
		orange_mc.gotoAndPlay("orangebutton4");
		lilac_mc.gotoAndPlay("lilacbutton4");
		_root.afterpreload.everything.red1_mc.red2_mc.gotoAndPlay("red");
		this.onEnterFrame = function()
{
        if (_root.afterpreload.everything.red1_mc.red2_mc._currentframe == 116)
{
		loop_mc._visible = true;
		loop_mc.gotoAndPlay(1);
		red1_mc.gotoAndPlay(1);
		red1_mc._visible = false;
		spinning = true;
}
}
	}
}

Heres code that doesn’t work.


green_mc.onRelease = function(){
	if (spinning){
		loop_mc._visible = false;
		loop_mc.stop();
		green1_mc._visible = true;
		green1_mc.gotoAndPlay(2);
		green_mc._visible = true;
		green_mc.gotoAndPlay("greenbutton1");
		red_mc.gotoAndPlay("redbutton3");
		blue_mc.gotoAndPlay("bluebutton3");
		yellow_mc.gotoAndPlay("yellowbutton3");
		orange_mc.gotoAndPlay("orangebutton3");
		purple_mc.gotoAndPlay("purplebutton3");
		lilac_mc.gotoAndPlay("lilacbutton3");
		spinning = false;
	}else{
		green_mc.gotoAndPlay("greenbutton2");
		purple_mc.gotoAndPlay("purplebutton4");
		blue_mc.gotoAndPlay("bluebutton4");
		red_mc.gotoAndPlay("redbutton4");
		yellow_mc.gotoAndPlay("yellowbutton4");
		orange_mc.gotoAndPlay("orangebutton4");
		lilac_mc.gotoAndPlay("lilacbutton4");
		_root.afterpreload.everything.green1_mc.green2_mc.gotoAndPlay("green");
		this.onEnterFrame = function()
{
        if (_root.afterpreload.everything.green1_mc.green2_mc._currentframe == 116)
{
		loop_mc._visible = true;
		loop_mc.gotoAndPlay(1);
		green1_mc.gotoAndPlay(1);
		green1_mc._visible = false;
		spinning = true;
}
}
	}
}

To see the problem in action go to www.sportstv.eu.com/stvtest.htm. You’ll need Flash 8 player. The first 3 buttons work and the next 4 don’t.

Any ideas?