Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mx.com.disegni.display{
- import flash.display.Sprite;
- import flash.display.Graphics;
- public class DisegniMain extends Sprite{
- protected var _stageWidth:Number;
- protected var _stageHeight:Number;
- protected var _backgroundColor:uint;
- protected var _width:Number;
- protected var _height:Number;
- public function DisegniMain(stageWidth:Number = 1280,stageHeight:Number = 800,backgroundColor:uint = 0xFFFFFF){
- _width = _stageWidth = stageWidth;
- _height = _stageHeight = stageHeight;
- _backgroundColor = backgroundColor;
- }
- protected function paint(g:Graphics):void{
- g.clear();
- g.beginFill(_backgroundColor,1);
- g.drawRect(0,0,_width,_height);
- g.endFill();
- }
- public function repaint():void{
- paint(this.graphics);
- }
- protected function layout():void{
- }
- public function setSize(width:Number,height:Number){
- _width = width;
- _height = height;
- repaint();
- }
- ////////////////////////////////////////////////////////////////////////////////////////////
- override public function get width():Number{
- return _width;
- }
- override public function get height():Number{
- return _height;
- }
- //Helpers Layout
- public function X(n:Number):Number{
- return (n -(_width - _stageWidth)/2);
- }
- public function Y(n:Number):Number{
- return (n -(_height - _stageHeight)/2);
- }
- ////////////////////////////////////////////////////////////////////////////////////////////
- }
- }
Advertisement