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:

  1. How to Disable Tab Button Cheating using AS2
  2. How to make a dress up game
  3. Code Bits: if statements