_quality Property in Flash

In this tutorial, I'm going to discuss the _quality Property in Flash. As you can guess, it can be used to set the quality of your movie.

By default, if you preview your Flash project, its quality will be "high". This is almost always a good thing—with a few exceptions. For example, it can happen that one of your viewers is still on an acient PC. If your movie contains many CPU-consuming scenes, watching it might not be a very pleasant experience for him.

But nothing's for free: If we set the quality  "low", the movie will definitely become much less attractive.

Of course, one can set the quality by simply right-clicking on the SWF file and changing the quality setting.


[ right-click on any SWF for a drop-down like this to appear ]

But what if someone doesn't know this little trick? Well, it would then be a good idea to have a look at how to let viewers do it in a "more civilized" way. 

I think it would be best if the viewer could change the _quality property right at the beginning. Don't you agree?

If so, let's try to do this :-)


Here's how you can do this

i. Create a new Flash document, 300x300, 20 fps or higher.

ii. Import an image of something—for example, a picture of a lady :-)

Buttons

We are going to change the quality of the SWF by means of Buttons.

iii. Draw a circle and press F8 to convert it to a symbol. Make it a button. The name doesn't matter.

[ remember to select Button in Behavior (in Flash 8 it has been changed to Type) ]

 

v. Next, Copy (Ctrl + C) and Paste (Ctrl + V) the button two times. You should now have three buttons on the stage.

vi. Now it's time to give each of them an instance name.

To so that, open your Properties Window by pressing Ctrl + F3. Select the leftmost of the buttons, and look in the bottom left corner of the Properties Window. You should see a small <instance name> field there. Type "high" in this field. Do the same operation with the other two button, naming them "medium" and "low".

Note: In the above image, the instance name is "circle". That's because it is an image from another tutorial. Your instance names should be "high", "medium" and "low". Similarly, above the instance name, it says "Movie Clip", while in our tutorial it should be "Button".

Actionscript

vii. Select the first frame of your Timeline and press F9 to activate the Actionscript window. Type the following code there:
high.onRollOver = function(){
_quality = "high"
}
medium.onRollOver = function(){
_quality = "medium"
}
low.onRollOver = function(){
_quality = "low"
}

 

Explanation

high.onRollOver = function(){
We create a function which is executed every time we roll over the "high" button.

But what does this function contain?

_quality = "high"

Between the function's opening and closing brackets ( { } ), we can find a simple command: "Change the quality of the SWF file to 'high'! Now!"

The rest of the functions are the same as the one above except that they use the remaining two buttons to change to quality to "medium" and "low".


Conclusion

All in all, I think it is a really great idea to let the viewers set the quality of the movie at the beginning. Remember that not everyone might have such a powerful machine as you do! 

Also, remember that your "quality changer" does not have to look the same as mine—it can be a whole lot better! Use your imagination to create something really attractive.



So! This is the end of this tutorial. I hope it has helped you expand your Flash knowledge. I also hope it wasn't "just another" boring tutorial. :-)

Cheers!

Average: 3.8 (6 votes)