In the last blog, we looked at getting started with a simple Helloworld Apache Royale application and the prerequisites setup required for the same. The Apache Royale Framework is a framework under active development with multiple contributors to this open source. Many of the emulation components migrated from Flex have not been implemented completely and Apache Royale provides some recommendations on creating a high level emulation component you would need.
Apache Royale comprises of the following three parts:
Each of the above three parts are hosted in a separate GIT repository and should be built and released separately. They should be built in the same order as given above.
In this blog, we will look at setting up the prerequisites for making changes to the Royale framework and building the changes along with the binary distribution of the Royale SDK which can be used in your IDE of choice.
As always, we will first look at the prerequisites before we start working on the framework code.
Apart from the prerequisites listed in the previous , specifically Java SDK and FLASHPLAYER_DEBUGGER, we will require the following
1.Download the maven binary from . Unzip it to a folder of your choice like C:\apache-maven-3.6.0
2.Go to Environment variables and add to System variable path “C:\apache-maven-3.6.0\bin”
3.Open terminal and check version of Maven as
4.Clone the compiler, typedefs and the framework code and build using mvn or ant(already installed in last blog).
We will be getting the source code of the framework from GitHub using the following commands:
Now you are ready to make changes in the apache royale code. We will be working on
the framework code only in this blog.
For this exercise, we picked up a small issue in the framework code, reported on the git community, where the currency formatter was not available/working.
The intent of the currency formatter should be to give the data formatted with the currency symbol and comma for a thousand separator and decimal point symbol for decimal separator. For e.g.On giving 34567987, it should give $34,567.987.
Open the framework code, in your editor. The framework code will exist in the path frameworks/projects/<specific project> for example MXRoyale or SparkRoyale.
On investigating the framework code for mxroyale under frameworks/projects/MXRoyale/src/main/royale/mx/formatters, we noticed an existing file named CurrencyFormatter, but if we tried to use the same component in our Application code, the tag was not recognized and the code was throwing an error.
Below is the sample mxml code where we included the currencyformatter to format the user entered currency, but it was giving an error that the tag is unexpected.
On investigating, we found the CurrencyFormatter.as file was present in the formatters folder along with other formatters but was not included in the mx-royale-manifest.xml
The below entry was added in the manifest file.
Also going through the ActionScript code, we found some issues related to the decimal Separator and fixed it. Now we needed to compile and test our changes by having this modified code to be considered as the sdk in the IDE(Moonshine).
This implies that we needed to compile the code for distribution so that it can be utilized as the framework for other applications.