Chapter 37 Example 10
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/nzQl
*/
package {
import flash.display.Sprite;
import flash.filters.ColorMatrixFilter;
public class ch37ex10 extends Sprite {
function ch37ex10() {
var img:TestImage = new TestImage();
addChild(img);
var grayMat:Array = [0.3086, 0.6094, 0.082, 0, 0,
0.3086, 0.6094, 0.082, 0, 0,
0.3086, 0.6094, 0.082, 0, 0,
0, 0, 0, 1, 0];
img.filters = [new ColorMatrixFilter(grayMat)];
}
}
}
import flash.display.Loader;
import flash.net.URLRequest;
import flash.system.LoaderContext;
class TestImage extends Loader {
public function TestImage(scale:Number = 1, x:Number = 0, y:Number = 0) {
//photo (CC-BY) Roger Braunstein
//source http://www.flickr.com/photos/rogerimp/2940373537/
var url:String = "http://actionscriptbible.com/files/heiwadoori.jpg";
load(new URLRequest(url), new LoaderContext(true));
scaleX = scaleY = scale;
this.x = x; this.y = y;
}
}