/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { import flash.display.Bitmap; import flash.display.Shader; import flash.display.Sprite; import flash.filters.*; import flash.utils.ByteArray; public class PixelBenderTest extends Sprite { [Embed(source='image.jpg')] private var ImageFile:Class; [Embed(source="filter.pbj" , mimeType="application/octet-stream")] private var FilterFile : Class; private var shader:Shader; private var filter:ShaderFilter; private var bmp:Bitmap; public function PBTest() { bmp = new ImageFile() as Bitmap; shader = new Shader( new FilterFile() as ByteArray ) ; shader.data.size.value = [20]; shader.data.base.value = [400,250]; filter = new ShaderFilter(shader); bmp.filters = [ filter ]; addChild(bmp); } } }