/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var imageLoader:Loader = new Loader(); var imageURL:String = "pixels.png"; var imageRequest:URLRequest = new URLRequest(imageURL); imageLoader.load(imageRequest); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); function imageLoaded(event:Event):void{ var bitmap:BitmapData = new BitmapData(imageLoader.width, imageLoader.height, true, 0); bitmap.draw(imageLoader, new Matrix()); var matrix:Matrix = new Matrix(); matrix.scale(5,5); var circleDrawing:Sprite = new Sprite(); circleDrawing.graphics.lineStyle(); circleDrawing.graphics.beginBitmapFill(bitmap, matrix); //circleDrawing.graphics.drawCircle(100, 100, 100); circleDrawing.graphics.drawEllipse(200, 300, 100, 200); addChild(circleDrawing); //circleDrawing.x = 300; var bevel:BevelFilter = new BevelFilter(); bevel.blurX = 20; bevel.blurY = 20; bevel.quality = 1; bevel.angle = 30; bevel.distance = 30; bevel.shadowAlpha = 1; bevel.highlightAlpha = 1; bevel.shadowColor = 0xFF0000; bevel.highlightColor = 0xFFFFFF; bevel.strength = 1; //normal range 0 to 1, could go higher var filtersArray:Array = new Array(bevel); circleDrawing.filters = filtersArray; }