Posted By

mswallace on 06/07/07


Tagged

actionscript flash api Drawing 3 Blur Gradiant Fill


Versions (?)

Who likes this?

9 people have marked this snippet as a favorite

alidrongo
copyleft
johng
swfgeek
THEPWN3R
enajenkins
loric
tspitzr
Josueriv


AS3 Draw Square, Blur, and Gradiant Fill


 / Published in: ActionScript 3
 

  1. var squareDrawing:MovieClip = new MovieClip();
  2. this.addChild(squareDrawing);
  3.  
  4. squareDrawing.graphics.lineStyle(1, 0x000000, 1);
  5. var fillType:String = GradientType.RADIAL;
  6. var colors:Array = [0xFF0000, 0x0000FF];
  7. var alphas:Array = [100, 100];
  8. var ratios:Array = [0, 255];
  9. var matr:Matrix = new Matrix();
  10. matr.createGradientBox(200, 100, 0, -50, 100);
  11. var spreadMethod:String = SpreadMethod.REFLECT; //REPEATE, PAD, OR REFLECT
  12.  
  13. squareDrawing.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
  14.  
  15.  
  16. squareDrawing.graphics.drawRect (0, 0, 100, 300);
  17. squareDrawing.graphics.endFill();
  18. squareDrawing.graphics.drawRoundRect(200, 0, 100, 300, 50);
  19.  
  20. var blur:BlurFilter = new BlurFilter();
  21.  
  22. blur.blurX = 10;
  23. blur.blurY = 10;
  24. blur.quality = 1;
  25.  
  26. var filterArray:Array = new Array(blur);
  27. squareDrawing.filters = filterArray;
  28.  
  29.  
  30. squareDrawing.x = 500;
  31. squareDrawing.y = 100;

Report this snippet  

You need to login to post a comment.