How to use the Application component

The Application component is an optional root class for Feathers UI projects. It may use layouts, similar to a LayoutGroup, and it provides the ability to scale your project for different screen sizes, similar to the way native applications do it.

If you prefer, you may use OpenFL's Sprite as a root class for Feathers UI projects. The use of Application is completely optional.

The Basics

Create a new class that extends Application.

import feathers.controls.Application;

class MyProject extends Application {
    public function new() {
        super();

        var label = new Label();
        label.text = "Hello from Feathers UI and OpenFL";
        addChild(label);
    }
}

To use this class as your project's entry point, you must reference it in your project.xml file. The <app> element has a main attribute that should be set to the name of this class.

<app main="MyProject"/>

Here's a sample project.xml file for context.

<?xml version="1.0" encoding="utf-8"?>
<project>
    <meta title="My Project" package="com.example.MyProject" version="1.0.0" company="My Company"/>
    <app main="MyProject" path="build" file="MyProject"/>
    <window allow-high-dpi="true"/>
    <window fps="60"/>
    <window fps="0" if="html5"/>
    <source path="src"/>
    <haxelib name="openfl"/>
    <haxelib name="actuate"/>
    <haxelib name="feathersui"/>
</project>