AS3 Image Map, Circle, bevel filter


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var imageLoader:Loader = new Loader();
  2. var imageURL:String = "pixels.png";
  3. var imageRequest:URLRequest = new URLRequest(imageURL);
  4. imageLoader.load(imageRequest);
  5.  
  6. imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
  7.  
  8. function imageLoaded(event:Event):void{
  9. var bitmap:BitmapData = new BitmapData(imageLoader.width, imageLoader.height, true, 0);
  10. bitmap.draw(imageLoader, new Matrix());
  11. var matrix:Matrix = new Matrix();
  12. matrix.scale(5,5);
  13.  
  14. var circleDrawing:Sprite = new Sprite();
  15. circleDrawing.graphics.lineStyle();
  16. circleDrawing.graphics.beginBitmapFill(bitmap, matrix);
  17. //circleDrawing.graphics.drawCircle(100, 100, 100);
  18. circleDrawing.graphics.drawEllipse(200, 300, 100, 200);
  19. addChild(circleDrawing);
  20. //circleDrawing.x = 300;
  21.  
  22. var bevel:BevelFilter = new BevelFilter();
  23. bevel.blurX = 20;
  24. bevel.blurY = 20;
  25. bevel.quality = 1;
  26. bevel.angle = 30;
  27. bevel.distance = 30;
  28. bevel.shadowAlpha = 1;
  29. bevel.highlightAlpha = 1;
  30. bevel.shadowColor = 0xFF0000;
  31. bevel.highlightColor = 0xFFFFFF;
  32. bevel.strength = 1; //normal range 0 to 1, could go higher
  33.  
  34. var filtersArray:Array = new Array(bevel);
  35. circleDrawing.filters = filtersArray;
  36.  
  37. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.