In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: BitmapData sandbox

import flash.text.TextField;
Get Adobe Flash player
by ohisama 02 Feb 2013
    Embed
// forked from Karl94's BitmapData sandbox
package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BitmapDataChannel;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.filters.DisplacementMapFilter;
    import flash.geom.Point;   
    import net.hires.debug.Stats;
    public class FlashTest extends Sprite
    {
        private var bitmap : BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false);
        private var loader : Loader = new Loader();
        public function FlashTest()
        {
            stage.addChild(new Stats()); 
            for (var i : uint = 0; i < bitmap.width; i++)
            {
                for (var j : uint = 0; j < bitmap.height; j++)
                {
                    bitmap.setPixel(i, j, (0x80 * (1 + Math.sin(i / bitmap.width * Math.PI) * Math.sin(j / bitmap.height * 2 * Math.PI)) << 16) + (0x80 * (1 + Math.sin(j / bitmap.height * Math.PI) * Math.sin(i / bitmap.width * 2 * Math.PI)) << 8));
                }
            }
            loader.load(new URLRequest("http://assets.wonderfl.net/images/related_images/0/06/0674/06742700b3add32f96aa64c71eece12b3f43d80c"), new LoaderContext());
            //loader.filters = [new DisplacementMapFilter(bitmap, new Point(0, 0), 2, 1, 50, 50)];
            //addChild(new Bitmap(bitmap));
            addChild(loader);
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        private function onEnterFrame(e : Event) : void
        {
            loader.filters = [new DisplacementMapFilter(bitmap, new Point(0, 0), 2, 1, mouseX - stage.stageWidth / 2, mouseY - stage.stageHeight / 2)];
        }
    }
}