Why to use sharpness for textFields in Flash AS3 (Actionscript)

Posted by druva | as3, utils | Friday 27 February 2009 4:04 am
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;

var labelText:String = 'This is brown fox';

function TextFieldExample() {
 configureLabel(numberText1, -400);
 configureLabel(numberText2, -300);
 configureLabel(numberText3, -200);
 configureLabel(numberText4, -100);
 configureLabel(numberText5, 100);
 configureLabel(numberText6, 200);
 configureLabel(numberText7, 300);
 configureLabel(numberText8, 400);
 configureLabel(numberText9, -100);
}

var _arial_str:String;
var myFont:Font = new Font1();
function configureLabel(targ, shrp:Number):void {
 targ.footer_number.autoSize = TextFieldAutoSize.LEFT;
 targ.footer_number.background = false;
 targ.footer_number.border = false;
 targ.footer_number.sharpness = shrp;

 var format:TextFormat = new TextFormat();
 format.font = myFont.fontName;
 format.color = 0xFFFFFF;
 format.size = 30;
 targ.footer_number.defaultTextFormat = format;
 targ.footer_number.text = labelText;
 targ.sharpnessValue.text = 'Sharpness ' + String(shrp);
}
TextFieldExample();
sslider.addEventListener(Event.CHANGE, on_sliderChange);
function on_sliderChange(e:Event){
 configureLabel(numberText9, sslider.value);
}
 

Create Water Bubbles using Flash Actionscript 3.0 (AS3)

Posted by druva | Flash, as3, utils | Tuesday 17 February 2009 2:31 am

This a small example that shows how to create bubbles in flash


var bubbleCount:Number = 30;
var mWidth:Number = Stage.width;
var mHeight:Number = Stage.height;
var i = 0;
var minSpeed:Number = 2;

for (var i=0;i<bubbleCount;i++) {
 var bubble = this.attachMovie("bubble", "bubble" + i, i);

 bubble._x = Math.random() * mWidth;
 bubble._y = Math.random() * mHeight;
 bubble._xscale =  bubble._yscale =  bubble._alpha = 40 + Math.random() * 60;

 bubble.yspeed = Math.random() * 3 + minSpeed;
 bubble.onEnterFrame = function ()
 {
 this._y = this._y - this.yspeed;
 if (this._y <= 0)
 {
 this._y = 400;
 this._x = 10 + Math.random() * mWidth;
 }
 if (this._x >= mWidth || this._x <= 0)
 {
 this._y = 400;
 this._x = 10 + Math.random() * mWidth;
 }
 };

}

This is sample application with above code

This movie requires Flash Player 9

download source