Game Development Reference
In-Depth Information
s.graphics.drawRect(0, 0, bma.width, bma.height);
s.graphics.endFill();
s.x = 280;
s.y = 160;
addChild(s);
s.addEventListener(MouseEvent.CLICK, onExit);
}
private function onExit(event:MouseEvent):void {
trace("Clicked on Exit");
}
}
}
The resulting screen looks something like the following:
Filters: Adding effects to sprites
Time to learn about adding some cool effects to those sprites! Adding effects to
sprites is as easy as setting what are called filters to the sprite.
Filters can be added to any instance of DisplayObject class and to any of its
subclasses. Remember, Sprite is one of the subclasses, which is what you usually
play with, and makes it all perfect.
DisplayObject has a property called filters, which is an array. It means that we can
add more than one filter to a sprite enabling us to combine more than one effect to a
particular sprite to get the cool effect we want.
Flash provides a wide variety of filters under the package flash.filters . All filters
are a subclass of the common base class known as BitmapFilter.
 
Search WWH ::




Custom Search