Flash player only has three qualities, "low", "medium", and "high".
By default, the context menu (what appears on a right-click) for an swf file has the quality setting which can be changed by the user.
You can edit this in actionscript 2 by modifying the _quality property.
Example: _quality = "low"
If you want the quality to be able to change automatically, I suppose you can have flash player monitor the milliseconds per frame using getTimer(), and if there is lag, change this attribute. Also, if you have effects (such as particle effects), you can turn them off.
For example:
fps = 12;
lag = 100;
lastTimer = getTimer();
onEnterFrame = function(){
timer = getTimer();
if(timer-lastTimer>1000/fps+lag){
_quality = "low";
particleEffectsOn = false;
}else{
_quality = "high";
particleEffectsOn = true;
lastTimer = timer();
}
}
The fps property defines the frames per second of the swf, so we can calculate the milliseconds per frame at optimum level. I went with the default 12.
The lag property determines how much lag the player will tolerate before lowering the quality, higher value = higher lag tolerance.
The property particleEffectsOn is useless until particle effects are added, and only display when the value is true.
Keep in mind I'm just throwing this out there, I haven't tested it, so it may not work as well as it is meant to.