topical media & game development
professional-flex-code-16-BitmapExample.ax
professional-flex-code-16-BitmapExample.ax
[swf]
flex
package
{
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.filters.ColorMatrixFilter;
public class @ax-professional-flex-code-16-BitmapExample extends Sprite
{
// Logo from http://media.wiley.com/assets/253/59/wrox_logo.gif
[Embed(source="local/assets/flex/wrox_logo.gif")]
private var logoClass:Class;
public function @ax-professional-flex-code-16-BitmapExample() {
if( stage != null ) {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
}
var filters:Array = new Array();
var matrix:Array = new Array();
matrix = matrix.concat( [-1, 0, 0, 0, 256] ); // red
matrix = matrix.concat( [0, -1, 0, 0, 256] ); // green
matrix = matrix.concat( [0, 0, -1, 0, 256] ); // blue
matrix = matrix.concat( [0, 0, 0, 1, 0] ); // alpha
var filter:ColorMatrixFilter = new ColorMatrixFilter( matrix );
filters.push( filter );
var myBitmap:Bitmap = new logoClass();
addChild( myBitmap );
var myBitmap2:Bitmap = new logoClass();
myBitmap2.filters = filters;
myBitmap2.y = myBitmap.height + 20;
addChild( myBitmap2 );
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.