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.
<?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.
Where to go from here
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: