How to Make a Quality Button
Although it would be nice, not everyone has overclocked, quad-core processors with 8 Gigs of RAM. Some people’s computers aren’t fast enough to render all the code and graphics you have in your flash game at the speed the game was designed for. In that case, you’ll want to give your player the option to turn down the quality. In this tutorial on quality buttons, I’m going to teach you how to change the quality of a game or movie using actionscript 2 code in a button.
The first thing you should know in this tutorial are the codes for quality. They are:
_quality = "LOW"; _quality = "MEDIUM"; _quality = "HIGH"; _quality = "BEST";
Now that we know that, it should be easy to implement a button that toggles the quality. The first thing you’ll want to do is make your button. Draw your button, whatever it may look like, and select it. Now hit F8 to make it into a symbol. Be sure to select the button option. It doesn’t matter where the registration is, but I prefer mine in the middle.
Now go to the button’s code and put this in:
on (press) {// when the button is pressed if (_quality == "HIGH") {//if the quality is set to high.. _quality = "MEDIUM";//set the quality to medium } else if (_quality == "MEDIUM") {//if the quality is not high, then check to see if it is medium. _quality = "LOW";//if it is medium, make the quality low } else if (_quality == "LOW") {// if the quality is not medium or high and if the quality is in fact low... _quality = "HIGH";//make the quality high }//ends if statement }//ends code
Congratulations, you’ve made your quality button. If you want to pull the absolute best image quality out of your game or movie, you can also include the BEST option in there. Since most players are used to only 3 quality options though, I thought I would leave it out of the button’s code.
Related posts:



February 18th, 2009 at 2:57 pm
The first code section has html in it. Also, you should never really use a press handler but an on release handler for a button.
February 18th, 2009 at 11:04 pm
Thanks. The plugin I’ve been using for code has been a bit buggy lately.
For the most part I use on(release), but for a quality button I thought I’d mix it up and use an on(press) handler. It’s all up to you though. Feel free to change it to release if you like. :)
August 5th, 2009 at 5:28 am
Yes, that works… but thats easier
Make button, Convert it to a button, then at the actions:
on (press) {
_quality = “LOW”;
}
or HIGH or MEDIUM
August 5th, 2009 at 9:13 am
Thanks TastyTeo, your way works as well. I guess it’s just a matter of preference as to which way is used.
March 27th, 2010 at 1:18 pm
The first method is using one button for all qualities.
TastyTeo’s one implies using one button per quality there is.
I agree with Director. It’s a matter of preference