00:00
00:00

AS: Quality Toggling

7,387 Views | 29 Replies
New Topic Respond to this Topic

AS: Quality Toggling 2005-07-01 10:32:53


AS: Main

Changing Quality

Short one, to answer a regular question.

When a swf is loaded inside a browser, the quality is set by the HTML embed tags. By default, it's usually set as HIGH. However, if you're releasing a graphicallly-intensive or code-heavy Flash, you may want to allow users with slower computers to switch to a lower quality, to ease some of the weight on their CPU (it's to your benefit too, since if their processor can't handle your Flash, it won't run smoothly and may well glitch or even crash). A lower quality makes it easier for the viewer's computer to keep the framerate constant, while a high quality focuses on the image instead of the playback.

From the Flash's AS Dictionary:
"LOW" Low rendering quality. Graphics are not anti-aliased, bitmaps are not smoothed.
"MEDIUM" Medium rendering quality. Graphics are anti-aliased using a 2 x 2 grid, in pixels, but bitmaps are not smoothed. Suitable for movies that do not contain text.
"HIGH" High rendering quality. Graphics are anti-aliased using a 4 x 4 grid, in pixels, and bitmaps are smoothed if the movie is static. This is the default rendering quality setting used by Flash.
"BEST" Very high rendering quality. Graphics are anti-aliased using a 4 x 4 grid, in pixels, and bitmaps are always smoothed.

The basic commands for setting swf quality are:

_quality = "LOW";
_quality = "MEDIUM";
_quality = "HIGH";
_quality = "BEST";

You can add any one of these actions to a frame if you wish, but generally you'll be better off including a Q button in your movie/game.
These actions will toggle HIGH>MEDIUM>LOW>HIGH etc (BEST is not generally necessary as an option)

on(press){
if(_quality=="HIGH"){_quality="MEDIUM";}
else if(_quality=="MEDIUM"){_quality="LOW";}
else if(_quality=="LOW"){_quality="HIGH";}
}

An alternative version:

on (release){
if(i++>=2){i=0;}
_quality=["HIGH", "MEDIUM", "LOW"][i];
}

If you just wish to switch between HIGH and LOW quality:

on(press){toggleHighQuality();}

If you just wish to switch between HIGH and MEDIUM quality:

on (press) {_quality=_quality=="HIGH" ? "MEDIUM" : "HIGH";}

Flash also has a command which will automatically detect movie framerate and adjust the quality if the framerate drops.
Personally, I don't like this too much, but it's there as an option. Just bung the action on the first frame of your movie.

_root._quality='autohigh';

======================================================

Since a question was asked about this yesterday, I guess it would do no harm to mention this as well:

In terms of setting movie quality/size as you export your swf, the only real control you have is the ability to adjust image and sound compression. To tweak these, go to FILE>PUBLISH SETTINGS>FLASH tab, and play with the JPEG quality slider and the Audio Stream and Audio Event MP3 settings.


- - Flash - Music - Images - -

BBS Signature

Response to AS: Quality Toggling 2005-07-01 10:33:46


He he, another great AS thread! To bad I already knew this. :-(

Response to AS: Quality Toggling 2005-07-01 10:36:17


Ah yes, Denvish out with some more AS. Nice one!

Response to AS: Quality Toggling 2005-07-01 10:39:39


Wow!I didn't know someone could type more than two paragraphs about quality!


BBS Signature

Response to AS: Quality Toggling 2005-07-04 21:08:19


great tut Denvish, i'd just wanna add that it's sometimes a good idea to just manualy set the quality of your movie on the frames you want when you know it's gonna be ghraphical intense or not intense at all.

Response to AS: Quality Toggling 2005-07-09 05:40:51


Add this to the first frame of your movie to allow the Q key to loop through quality settings:

myListener = new Object();
myListener.onKeyDown = function () {
if(Key.getCode() == 81){
if(i++>=2){i=0;}
_quality=["HIGH", "MEDIUM", "LOW"][i];
}
}
Key.addListener(myListener);


- - Flash - Music - Images - -

BBS Signature

Response to AS: Quality Toggling 2005-08-28 18:38:18


http://forums.xgenst..?p=380085#post380085

devnish, i think soemone ahs stolen your work

Response to AS: Quality Toggling 2005-08-28 18:40:11


Yup, indeed a nice copy/paste job there. Could be Denvish himself of course but I somehow doubt it.

Response to AS: Quality Toggling 2005-08-28 18:44:08


that's just nasty :S

I didn't expect him to do that :(

nasty

Response to AS: Quality Toggling 2005-08-28 18:52:43


At 8/28/05 06:40 PM, T-H wrote: Could be Denvish himself of course but I somehow doubt it.

Nope, it's the same guy as the one on NG with the same name. What a loser, and I helped him with AS once.


BBS Signature

Response to AS: Quality Toggling 2005-10-20 18:33:36


At 8/29/05 01:46 PM, ChronicLord wrote: For fuck sake.

Sorry Denvish, you can blame my brother for that. He has used my account since ive been on holiday. Ive edited the Xgen post so it does say thanks Denvish.

*I will beat my brother today*.

What a fucking noob liar. Okay..


wtfbbqhax

Response to AS: Quality Toggling 2005-10-20 19:40:37


denvish this is how amazing you are. you took a simple, copy and paste code and turned it into this!

cheers Denv


WEBSITE

BLOG ~ Dont fuck around with my dog. All that I can see I steal. ~

NG FFR ~ Automatic for the people.

BBS Signature

Response to AS: Quality Toggling 2005-10-20 20:49:35


At 7/1/05 10:32 AM, Denvish wrote: on(press){toggleHighQuality();}

nice and easy code, but Macromedia doesn't recommend it, since it's a deprecated method in Flash MX and later.

but i think we'll say fuck Macromedia :)


website :: hugostonge.com

my job :: we+are

Response to AS: Quality Toggling 2005-10-20 20:52:48


At 10/20/05 08:49 PM, gorman2001 wrote: nice and easy code, but Macromedia doesn't recommend it, since it's a deprecated method in Flash MX and later.

but i think we'll say fuck Macromedia :)

deprecated schmeprecated. int is deprecated, and I use it on virtually a daily basis. tellTarget is deprecated, but according to rumours, Tom Fulp used it in Dad'n'Me. If it works, then I see no reason not to use it.
=D


- - Flash - Music - Images - -

BBS Signature

Response to AS: Quality Toggling 2005-10-20 21:00:18


At 10/20/05 08:52 PM, Denvish wrote: int is deprecated...

exactly HOW depreciated is int, because ive always hated Math.round()...

int is so much shorter. so how exactly is it depreciated?

BBS Signature

Response to AS: Quality Toggling 2005-10-20 21:02:23


BTW if your game is mostly bitmaps, use low quality.

what is depricated anyway

Response to AS: Quality Toggling 2005-10-20 21:08:51


At 10/20/05 09:02 PM, Glaiel_Gamer wrote: what is depricated anyway

http://en.wikipedia.org/wiki/Deprecated
In computer software standards and documentation, deprecation is the gradual phasing-out of a software or programming language feature.

At 10/20/05 09:00 PM, authorblues wrote: exactly HOW depreciated is int, because ive always hated Math.round()...
int is so much shorter. so how exactly is it depreciated?

Dunno. Works for me. I rarely use Math. functions except in trig calculations.

At 10/20/05 09:03 PM, SpamBurger wrote: But arent commands deprecated becuase there is a much easier command? Like, with tellTarget, why use:

Habit


- - Flash - Music - Images - -

BBS Signature

Response to AS: Quality Toggling 2005-12-02 20:45:06


Hey, Denvish, what about the actionscript used in the "auto" quality button seen in "Pico's Unloaded" and "littleFoot"? I didn't see anything about that in the first post.

Other than that, great tutorial...just wished it had a LITTLE bit less to do with buttons and just FRAMES.


~

Response to AS: Quality Toggling 2005-12-02 20:50:43


At 12/2/05 08:45 PM, JonBro wrote: Hey, Denvish, what about the actionscript used in the "auto" quality button seen in "Pico's Unloaded" and "littleFoot"? I didn't see anything about that in the first post.
Other than that, great tutorial...just wished it had a LITTLE bit less to do with buttons and just FRAMES.

its just a _root._quality = "autohigh"
which CAN be found in denvish's first post:

At 7/1/05 10:32 AM, Denvish wrote: _root._quality='autohigh';

BBS Signature

Response to AS: Quality Toggling 2006-07-17 00:47:22


At 7/1/05 10:32 AM, Denvish wrote: _root._quality='autohigh';

shouldn't that be,

_quality = "autohigh";

You don't need the _root, and you need quotations, not what you put.

Response to AS: Quality Toggling 2006-07-17 01:37:05


At 7/17/06 12:47 AM, Snubby wrote:
At 7/1/05 10:32 AM, Denvish wrote: _root._quality='autohigh';
shouldn't that be,

_quality = "autohigh";

no, either way works.

Response to AS: Quality Toggling 2007-02-27 16:29:13


very nice i like i like. i really like the autohigh, but i understand why u dont really like it too much- it seems to take a while to decide.

Response to AS: Quality Toggling 2007-02-27 17:21:25


There was no need to post in this topic, leave it alone, the last post was in 2006!

Rest In Peace

Gorilla Studios || A game is like sex, its better when its free

BBS Signature

Response to AS: Quality Toggling 2007-02-27 18:16:19


nicely done.... =D


Blok' Party, Orbital Khaos, site, MSMstudios, Phrozen Phlame

BBS Signature

Response to AS: Quality Toggling 2007-08-06 15:41:31


God dammit, the q press AS gives me errors and doesn't work.


BBS Signature

Response to AS: Quality Toggling 2007-10-06 01:41:17


information...

i is learning lots :D


PM me if you think im cool

5 people think im cool ;_;

BBS Signature

Response to AS: Quality Toggling 2008-05-26 22:15:21


yeah, wut a great AS!


To think what one knows is to know. to know is thinking what one thinks. Wait, what?

Funniest Thread Ever

BBS Signature

Response to AS: Quality Toggling 2008-05-26 22:30:33


D: You bumped a thread that was decaying for half a year

Response to AS: Quality Toggling 2009-02-10 04:10:50


I'm using Flash MX and when I try any of these quality codes (as well as others I've found on the internet) it says that this script is going to slow down computer and therefore it refuses to run it.

Any ideas?

Response to AS: Quality Toggling 2009-02-10 04:15:39


At 2/10/09 04:10 AM, Stromming wrote: Any ideas?

Not sure. Even if you had it running on an enterFrame, I doubt it'd be enough to cause CPU overload. Check the other parts of your script for recursive functions (ones that keep calling themselves indefinitely) or infinite for/while loops.


- - Flash - Music - Images - -

BBS Signature