This Blog contains About Action script 3.0 Variables, Data types, Access specifies, Keywords, Operators, Conditional statements, Control statements, Arrays (Indexed, Associative, Multidimensional, Cloning), Functions, Symbols, Movie clips (Transformation point, Registration point, Loading images), Buttons, Events (Key board, Mouse, Timer, XML)Pre- defined function :- Random, Hit test object, Drag and drop, Sort, Loader, Tween,URL Loader, Video components, Audio Components, Sound Channel.
Wednesday, 19 December 2012
gradient background using as3 code
var rect:Shape=new Shape();
this.addChild(rect);
rect.x = 0;
rect.y = 0;
var rectWidth:Number = 640;
var rectHeight:Number = 480;
var mat:Matrix;
var colors:Array;
var alphas:Array;
var ratios:Array;
mat=new Matrix();
colors = [0x000000,0x006699];
alphas = [1,1];
ratios = [0,255];
mat.createGradientBox(rectWidth,rectHeight,toRad(-90));
rect.graphics.lineStyle();
rect.graphics.beginGradientFill(GradientType.LINEAR,colors,alphas,ratios,mat);
rect.graphics.drawRect(0,0,rectWidth,rectHeight);
rect.graphics.endFill();
function toRad(a:Number):Number
{
return a*Math.PI/180;
}
Out put looks like :-
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment