Skip to content

Instantly share code, notes, and snippets.

@illuzor illuzor/
Created Aug 16, 2015

What would you like to do?
package com.illuzor.antbuilddemo {
import com.illuzor.antbuilddemo.generators.AndroidTextGenerator;
import com.illuzor.antbuilddemo.generators.FlashPlayerTextGenerator;
import com.illuzor.antbuilddemo.generators.IOSTextGenerator;
import com.illuzor.antbuilddemo.interfaces.IGenerator;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class Main extends Sprite {
public function Main() {
if (stage) addEventListener(Event.ADDED_TO_STAGE, onAdded);
else onAdded();
private function onAdded(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, onAdded);
private function makeText():void {
var textGenerator:IGenerator;
CONFIG::flashplayer {
textGenerator = new FlashPlayerTextGenerator();
CONFIG::android {
textGenerator = new AndroidTextGenerator();
CONFIG::ios {
textGenerator = new IOSTextGenerator();
var textString:String = textGenerator.getText();
var textField:TextField = new TextField();
textField.autoSize = TextFieldAutoSize.LEFT;
textField.text = textString;
textField.x = (stage.stageWidth - textField.textWidth) / 2;
textField.y = (stage.stageHeight - textField.height) / 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.