/** * Lessons Example by Chris DeLeon * Feb 2009 * www.GameDevLessons.com * chris@GameDevLessons.com * */ package { import flash.display.Bitmap; import flash.display.Sprite; public class Grid extends Sprite { // public: these values are visible to outside classes // instead of "private", visible only within the class // static: these values can be referenced from the class name itself // ex. using Grid.WIDTH is valid if WIDTH is static // otherwise WIDTH must be referenced off an instance, i.e. // var anInstanceOfGrid:Grid = new Grid(); // anInstanceOfGrid.WIDTH public static const WIDTH:Number = 600.0; public static const HEIGHT:Number = 280.0; [Embed(source="/Assets/alienWorld.jpg")] public var backgroundImage:Class; public function Grid(targetSprite:Sprite): void { targetSprite.addChild( new backgroundImage() as Bitmap); } } }