Quite often I need to restrict a number to a range with a defined maximum and minimum value. Rather than using if else statements you can do this simply with Math.max and Math.min:
var restricted_value:Number = Math.max(MIN_VALUE, Math.min(MAX_VALUE, value));
This site went live recently. It was a very quick build using the Gaia framework.
It is XML driven and AS3.0
I was just put on to a great debugging tool called Arthropod.
It is highly configurable (including password protection) and includes many very handy features such as being able to switch between standard window behaviour and staying ‘always on top’. Also you can take a screenshot of your stage and send the bitmap through and it will show it to you in a new window!
Here is a small and simple class I wrote this morning to create an animated rising sun. You can configure the number of segments and the size very easily.
public class RisingSun extends Sprite
private var _segments :Number = 40;
private var _rad :Number = 730;
public function RisingSun()
x = 364;
y = 45;
graphics.drawCircle(0, 0, _rad);
var _angle:Number = Math.PI / _segments;
var a:Number = _angle;
for (var i:Number = 0; i < _segments; i++)
var s:Sprite = new Sprite();
a += _angle;
a += _angle;
private function _frame(e:Event):void
rotation += 0.5;