We help IT Professionals succeed at work.

Flash check box button

Bm71
Bm71 asked
on
Medium Priority
652 Views
Last Modified: 2013-11-11
I've built a working check box button with this code:

on (press){
 if(this._currentframe == 1){
   gotoAndStop(2)
 }else{
   gotoAndStop(1)
 }
}

I'm trying to make it preform the actions in the following code, but I don't know how to combine the two.


on (release) {
 
	if (buildingStatus == "on") {
		buildingStatus = "off";
		mapall2.ubuildings._alpha = 0;
		//mapall2.ubuildings
	} else {
		buildingStatus = "on";
		//mapall2.ubuildings.alpha = 0;
		mapall2.ubuildings._alpha = 100;
	}
	// mapall2.ubuildings._visible = !mapall2.ubuildings._visible;
}

Open in new window

Comment
Watch Question

having some more trouble?

Author

Commented:
I decided the project would work even better with check box buttons. Review my question and let me know what you think.

Thanks
are you using the check box in place of the buttons or you want the check box to function?
 correctly?
 
 
 GE

Author

Commented:
I'm wanting to use the checkbox buttons in place of the old buttons you helped with.
good Luck
GE

on (click) {
 
	if (buildingStatus == "on") {
		buildingStatus = "off";
		_root.mapall2.ubuildings._alpha = 0;
		//mapall2.ubuildings
		trace(buildingStatus);
	} else {
		buildingStatus = "on";
		//mapall2.ubuildings.alpha = 0;
		_root.mapall2.ubuildings._alpha = 100;
		trace(buildingStatus);
	}
	// mapall2.ubuildings._visible = !mapall2.ubuildings._visible;
}

Open in new window

are you having trouble with it?

GE
It's just a scope issue - post the full code/FLA here and we'll sort it out for you...

Author

Commented:
I got this to partially work. I had to change the "on (click)" at the beginning to "on (press)".  This activates the hidden info, but it still doesn't enable the check box to stay on. My checkbox buttons has two frames on it the first unchecked and the second checked. the original code I place on the button...

on (press){
 if(this._currentframe == 1){
   gotoAndStop(2)
 }else{
   gotoAndStop(1)
 }
}

enabled it to work. By that I mean toggling between a checked and unchecked state. Is there some way to incorporate this original with your code with the code you sent over?  
 
could you send me your present main file. so i can view the data.
and see what you mean directly?

feel free to drop a comment or 2 so i can find your code faster :)

Thx

GE

Author

Commented:
I sent it over.
file sent back.
please review and let me know

GE

Author

Commented:
I'm having trouble unstuffing the file. Can you send it as you did before. Zipped or now compression?

Bm71
fla sent over
GE

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thanks,
The checkbox button now works. Something I notice however is that the blue buildings are now longer clickable to bring bring up additional info. This function still works with the orginal button, but not the new checkbox button. How can this have any thing to do with the new checkbox?

Bm71
use this on the new check button

on (release) {
 
	if (_root.buildingStatus == "on") {
		_root.buildingStatus = "off";
		_root.mapall2.ubuildings._alpha = 0;
		this.gotoAndStop(1);
 
	} else {
		_root.buildingStatus = "on";
		//mapall2.ubuildings.alpha = 0;
		_root.mapall2.ubuildings._alpha = 100;
		this.gotoAndStop(2);
	}
	// mapall2.ubuildings._visible = !mapall2.ubuildings._visible;
}

Open in new window

Author

Commented:
Excellent! It's working.

Thanks
your welcome

good Luck with the rest of your project

GE
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.