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

ImageScrollXY

Get Adobe Flash player
by bradsedito 13 Oct 2011
    Embed
/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/sEwZ
 */

// forked from ikuko's flash on 2011-10-12
package {
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.display.Loader;
    import flash.geom.Matrix;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.system.LoaderContext;
    
    [SWF(backgroundColor = 0x000000, frameRate = 60, width = 900, height = 500)]
    public class Main extends Sprite {
        private const IMG_PATH:String ="http://a0.twimg.com/profile_images/1389298946/me_photo_cold_flash.png"; //"http://s3.amazonaws.com/twitpic/photos/full/421933572.jpg?AWSAccessKeyId=AKIAJF3XCCKACR3QDMOA&Expires=1318423246&Signature=9SwjiPKtqe8w2eE%2FkPCykgfpiVA%3D";    
        private var _bmd:BitmapData;
        private var _matrix:Matrix = new Matrix();
        private var _loader:Loader = new Loader();
        private var _context:LoaderContext = new LoaderContext(true);
        
        public function Main() {
            // write as3 code here..
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align    = StageAlign.TOP_LEFT;
            loadIMG();
        }
        
        private function loadIMG():void { 
            _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, cacheBMD);
            _loader.load(new URLRequest(IMG_PATH),_context);
        }
        
        private function cacheBMD(e:Event)    {
            _loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, cacheBMD);
            _bmd = new BitmapData(6354,_loader.content.height);
            _bmd.draw(_loader.content);
            
            addEventListener(Event.ENTER_FRAME, rotateHD);
        }
        
        private function rotateHD(e:Event)    {
            _matrix.tx += ((stage.stageWidth/2) - stage.mouseX)/20;
            
            if (_matrix.tx < -6354) _matrix.tx = 0;
            if (_matrix.tx > 6354) _matrix.tx = 0;
            
            graphics.clear();
            graphics.beginBitmapFill(_bmd,_matrix);
            graphics.drawRect(0,0,stage.stageWidth,_bmd.height);
        }

    }
}