Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nme.display.Sprite;
- import nme.Lib;
- import nme.events.Event;
- import nme.text.TextField;
- import nme.display.StageScaleMode;
- class Application extends flash.display.Sprite
- {
- public static inline var SCREEN_WIDTH = 640;
- public static inline var SCREEN_HEIGHT = 480;
- public var tf: TextField;
- public var i: Int;
- public function new()
- {
- super();
- addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
- graphics.beginFill(0xFF0000);
- graphics.drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- graphics.endFill();
- }
- public function onAddedToStage(event: Event)
- {
- this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
- onStageResize(null);
- }
- public function onStageResize(event: Event)
- {
- stage.scaleMode = StageScaleMode.EXACT_FIT;
- scaleX = stage.stageWidth / SCREEN_WIDTH;
- scaleY = stage.stageHeight / SCREEN_HEIGHT;
- }
- public static function main()
- {
- Lib.current.addChild(new Application());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement