We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

mswallace on 06/07/07


Tagged

actionscript flash filter api Drawing 3 DropShadow


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

copyleft
Akuma99


AS3 Drawing API Line Drawing and DropShadow


Published in: ActionScript 3 


Just some code that shows you how to set up the Drawing API and draw a line and also use the dropshadow filter.


  1. var lineDrawing:MovieClip = new MovieClip();
  2. this.addChild(lineDrawing);
  3.  
  4. lineDrawing.graphics.lineStyle(1);
  5. lineDrawing.graphics.moveTo(0,0); ///This is where we start drawing
  6. lineDrawing.graphics.lineTo(350, 600);
  7. lineDrawing.graphics.lineTo(600, 400);
  8.  
  9. var dropShadow:DropShadowFilter = new DropShadowFilter();
  10. dropShadow.color = 0x000000;
  11. dropShadow.blurX = 10;
  12. dropShadow.blurY = 10;
  13. dropShadow.angle = 0;
  14. dropShadow.alpha = 0.5;
  15. dropShadow.distance = 10;
  16.  
  17.  
  18. var filtersArray:Array = new Array(dropShadow);
  19. lineDrawing.filters = filtersArray;

Report this snippet 

You need to login to post a comment.