package {



import flash.display.Sprite;



public class tutorial extends Sprite {



public function tutorial()

{

}

}

}



package {



import flash.display.Sprite;

import flash.display.Bitmap;

import flash.display.BitmapData;

import flash.display.Loader;

import flash.geom.Rectangle;

import flash.geom.Point;

import flash.net.URLRequest;

import flash.events.*;



public class tutorial extends Sprite {



public function tutorial()

{

}

}

}



package {



import flash.display.Sprite;

import flash.display.Bitmap;

import flash.display.BitmapData;

import flash.display.Loader;

import flash.geom.Rectangle;

import flash.geom.Point;

import flash.net.URLRequest;

import flash.events.*;



public class tutorial extends Sprite {



public var myLoader:Loader = new Loader();



public function tutorial()

{

myLoader.load(new URLRequest("sprite.png"));

addChild(myLoader);

}

}

}



package {



import flash.display.Sprite;

import flash.display.Bitmap;

import flash.display.BitmapData;

import flash.display.Loader;

import flash.geom.Rectangle;

import flash.geom.Point;

import flash.net.URLRequest;

import flash.events.*;



public class tutorial extends Sprite {



public var sourceBD:BitmapData = new BitmapData(300*8, 200, true);

public var sourceBMP:Bitmap = new Bitmap(sourceBD);

public var targetBD:BitmapData = new BitmapData(300, 200, true);

public var targetBMP:Bitmap = new Bitmap(targetBD);



public var myLoader:Loader = new Loader();



public function tutorial()

{

addChild(targetBMP);

targetBMP.y=250;

myLoader.load(new URLRequest("sprite.png"));

addChild(myLoader);

}

}

}



addChild(sourceBMP);sourceBMP.y=400;

package {



import flash.display.Sprite;

import flash.display.Bitmap;

import flash.display.BitmapData;

import flash.display.Loader;

import flash.geom.Rectangle;

import flash.geom.Point;

import flash.net.URLRequest;

import flash.events.*;



public class tutorial extends Sprite {



public var sourceBD:BitmapData = new BitmapData(300*8, 200, true);

public var sourceBMP:Bitmap = new Bitmap(sourceBD);

public var targetBD:BitmapData = new BitmapData(300, 200, true);

public var targetBMP:Bitmap = new Bitmap(targetBD);



public var myLoader:Loader = new Loader();



public function tutorial()

{

addChild(targetBMP);

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);

targetBMP.y=200;

myLoader.load(new URLRequest("sprite.png"));

addChild(myLoader);

}



public function onLoad(event:Event):void

{

sourceBD.draw(myLoader);

}

}

}



copyPixels(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, alphaBitmapData:BitmapData = null, alphaPoint:Point = null, mergeAlpha:Boolean = false):void





targetBitmapData.copyPixels(sourceBitmapData, sourceRectangle, destinationPoint)





package {



import flash.display.Sprite;

import flash.display.Bitmap;

import flash.display.BitmapData;

import flash.display.Loader;

import flash.geom.Rectangle;

import flash.geom.Point;

import flash.net.URLRequest;

import flash.events.*;



public class tutorial extends Sprite {



public var sourceBD:BitmapData = new BitmapData(300*8, 200, true);

public var sourceBMP:Bitmap = new Bitmap(sourceBD);

public var targetBD:BitmapData = new BitmapData(300, 200, true);

public var targetBMP:Bitmap = new Bitmap(targetBD);



public var myLoader:Loader = new Loader();



public var frame:uint=0;



public function tutorial()

{

addChild(targetBMP);

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);

targetBMP.y=250;

myLoader.load(new URLRequest("sprite.png"));

addChild(myLoader);

myLoader.addEventListener(MouseEvent.CLICK, onClick);

}



public function onClick(event:MouseEvent):void

{

targetBD.copyPixels(sourceBD, new Rectangle(300*frame,0,300*frame+300,200),new Point(0, 0));

}



public function onLoad(event:Event):void

{

sourceBD.draw(myLoader);

}

}

}



package {



import flash.display.Sprite;

import flash.display.Bitmap;

import flash.display.BitmapData;

import flash.display.Loader;

import flash.geom.Rectangle;

import flash.geom.Point;

import flash.net.URLRequest;

import flash.events.*;



public class tutorial extends Sprite {



public var sourceBD:BitmapData = new BitmapData(300*8, 200, true);

public var sourceBMP:Bitmap = new Bitmap(sourceBD);

public var targetBD:BitmapData = new BitmapData(300, 200, true);

public var targetBMP:Bitmap = new Bitmap(targetBD);



public var myLoader:Loader = new Loader();



public var frame:uint=0;



public function tutorial()

{

addChild(targetBMP);

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);

targetBMP.y=250;

myLoader.load(new URLRequest("sprite.png"));

addChild(myLoader);

myLoader.addEventListener(MouseEvent.CLICK, onClick);

}



public function onClick(event:MouseEvent):void

{

targetBD.copyPixels(sourceBD, new Rectangle(300*frame,0,300*frame+300,200),new Point(0, 0));

frame++;

if(frame==8)

frame=0;

}



public function onLoad(event:Event):void

{

sourceBD.draw(myLoader);

}

}

}

