Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mkv25.test;
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.Lib;
- import flash.text.TextField;
- import flash.text.TextFieldType;
- class Main extends Sprite
- {
- var inited:Bool;
- /* ENTRY POINT */
- function resize(e)
- {
- if (!inited) init();
- // else (resize or orientation change)
- }
- function init()
- {
- if (inited) return;
- inited = true;
- var HH = stage.stageHeight / 2;
- var FW = stage.stageWidth;
- var g = this.graphics;
- g.beginFill(0xFFFFFF);
- g.drawRect(0, 0, FW, HH);
- g.endFill();
- g.beginFill(0x000000);
- g.drawRect(0, HH, FW, HH);
- g.endFill();
- var textInput:TextField = new TextField();
- textInput.type = TextFieldType.INPUT;
- textInput.selectable = true;
- textInput.width = FW;
- textInput.height = HH;
- var format = textInput.defaultTextFormat;
- format.size = 60;
- textInput.defaultTextFormat = format;
- textInput.setTextFormat(format);
- addChild(textInput);
- }
- /* SETUP */
- public function new()
- {
- super();
- addEventListener(Event.ADDED_TO_STAGE, added);
- }
- function added(e)
- {
- removeEventListener(Event.ADDED_TO_STAGE, added);
- stage.addEventListener(Event.RESIZE, resize);
- #if ios
- haxe.Timer.delay(init, 100); // iOS 6
- #else
- init();
- #end
- }
- public static function main()
- {
- // static entry point
- Lib.current.stage.align = flash.display.StageAlign.TOP_LEFT;
- Lib.current.stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
- Lib.current.addChild(new Main());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment