/ Published in: ActionScript 3
If you’ve ever wanted to create a block of filled colour with a gradient for a background, similar to the standard Flex background
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var mat:Matrix = new Matrix(); var bg:Sprite = new Sprite(); mat.createGradientBox( stage.stageWidth, stage.stageHeight, Math.PI * .5 ); bg.graphics.beginGradientFill( GradientType.RADIAL, [ 0xFFFFFF, 0xFF0000 ], [ 1, 1 ], [ 0, 255 ], mat ); bg.graphics.drawRect( 0, 0, stage.stageWidth, stage.stageHeight ); bg.graphics.endFill(); addChild( bg );