Creating a Hello World in Apache Royale

Creating a Hello World in Apache Royale

Creating a Hello World in Apache Royale 750 560 Carlos Rovira

This section will try to bring simple code examples that should help to develop with Apache Royale more quickly. This is in part a tribute to Peter deHaan blogs he did for Apache Flex, ActionScript 3 and Adobe AIR some years ago. Hope you like it and want to contribute to get a huge library of Royale code snippets well organized and searchable.

So lets begin with our first code snippet: Hello World.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="utf-8"?>
<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:js="library://ns.apache.org/royale/basic">

    <js:valuesImpl>
        <js:SimpleCSSValuesImpl />
    </js:valuesImpl>

    <js:initialView>
        <js:View>
            <js:Label text="Hello World" />
        </js:View>
    </js:initialView>
</js:Application>

In this example you can see the use of the following MXML tags:

  • Application: Is the main tag in your application. All content in Apache Royale is added inside this tag.
  • SimpleCSSValuesImpl: This class implements a minimal set of CSS rules that is sufficient for most applications.
  • View: This is the class for most views in a Royale application.
  • Label: Implements the basic control for show a label with text.

The result of this “Hello World” code snippet is the following:

(We’re using an iframe to host the actual results of this example compilation. To see the example in a separate window click this link.)

Full project with source code can be found here:

Join Us!

You can be part of Apache Royale and start using and contributing to this project. We need your skills to make this great technology reach the next step. You can start by joining us in our mailing list.