What is Apache Flex?
Apache Flex is an open source application framework. It allows us to easily build a mobile application for Android, IOS, and BlackBerry Tablet OS devices. We can also build a traditional application for browser and desktop using the same programming model, tool, and codebase. We can easily create mobile apps using Apache Flex Framework.
Apache Flex, formerly Adobe Flex, is a software development kit (SDK). We can use Flex SDK to create a wide range of highly interactive and expressive application.
For example: – A data visualization application built in Apache Flex can pull the data from several back-end sources and display it visually. Apache Flex is developer friendly. In 2011, Adobe donated Flex to the Apache Software Foundation.
Flex uses MXML and ActionScript. MXML is used to define UI layouts and other non-visual static aspects. ActionScript is used to address dynamic aspects and as code-behind. Flex requires Adobe AIR or Flash Player at runtime to the application.
Advantage of Apache Flex
- Apache Flex runs on the Adobe Flash Player, which can be found almost everywhere.
- Adobe supports Apache Flex.
- Apache Flex apps can easily run outside the browser and offline.
- IDE support comes from Adobe with FlashBuilder and JetBrains with IntelliJ.
Key Features of Apache Flex
One Codebase Output Everywhere
Apache Flex SDK allows us to write the code that is highly reusable and deployable on all major platforms. To make your application stylish and attractive with minimal works, utilize the UI components such as buttons, containers, forms, data grids, lists, etc.
In the browser
We can make available our application to over 90% of internet-connected devices by targeting the Adobe Flash Player. Target the Internet Explorer 5+, Firefox, Chrome, Opera, and Safari on Windows, Mac OSX, Linux, and Solaris OS in a predictable and consistent manner.
Mobile and Tablets
It has never been easier for several mobile platforms like Apple iPods, iPads, and Android devices to develop applications when coupled with Adobe AIR. So, Apache Flex provides a way where we can deploy our apps to the respective app store and save time spent making native applications.
Choose your Tools
Do you need to develop the native applications for Apple, but only have PC? Do you want to write your mobile app for both platforms in your choice of IDE? With support from Eclipse-based Adobe Flash Builder, FDT, FlashDevelop and JetBrains IntelliJ IDEA we can work at our own pace, using the platform we want.
Apps on the TV
Apache Flex application can be compiled for use on smart TV utilizing the Broadcom platform. Don’t add another native platform yet that we need to learn in order to publish our apps where our customers are. Apache Flex has the tool chain in place for us to go where we want to go.
- The very first requirement of Apache Flex is JDK 1.4 or higher is installed in our system. Verify Java installation on our machine by executing the given commands for different platforms.
|Linux||CMD Terminal||$ java –version|
- Adobe Flex requires Adobe AIR at runtime to the application. We can download Adobe AIR from the official site, i.e., https://get.adobe.com/air/otherversions/
- Adobe Flash Player is also required.
How to Apache Flex SDK?
We can download Apache Flex for Windows, Linux, and Mac OS. The following steps are given for windows.
Step 1: For download, the Flex SDK clicks on http://flex.apache.org and go to Download Flex.
Step 2: Go to Download Flex a SDK Installer (For Application Developer).
Step 3: Here, we get the latest Apache SDK, i.e., 4.16.1. The Apache Flex suggests that we download the latest released version. Click on the download button.
Step 4: Now, we run the Apache Flex and set the location where we want to install. Click on Continue and follow the instructions.
Step 5: Now, we need to select our Flex, AIR, and Flash Player version. Click on Next button after selecting the versions for each application.
Step 6: Select the installation directory C:\Program Files\Apache Flex\Apache Flex 4.16.1 v32. We will need to create an Apache Flex 4.16.1 v32 directory.
Step 7: Here, we have to check all the boxes to accept each of the License Agreements. Click on the Install button to download all the components into new Apache Flex 4.16.1 v17 directory.
Step 8: Once we click on the Install button, the installation of Apache Flex is started.
Step 9: Apache Flex is successfully installed. Click on OPEN APACHE FLEX FOLDER to see the Apache Flex files.
Creating our first Hello World application
It is very simple, easy, generic Hello World application. If you want to learn, check out some other resource and videos http://flex.apache.org/doc-videos.html.
- Set the height and weight of your application to the application tag.
- Add a new Layout tag within the application tags. This will tell Apache Flex that how we plan on laying out our app.
<s: layout></s: layout>
- Add a BasicLayout tag within layout tags, and this will tell Flex that where to place our components.
<s: BasicLayout />
- Add a Label tag between the Application and Layout tags. We will be setting theText horizontalCenter and verticalCenter properties.
123<s: Label text=”Hello World!” horizontalCenter=”0” verticalCenter=”0” />
- Click on Debug toolbar. Our application should launch in our default web browser. Hello World! Will appear in the middle of the screen.
<? xml version= “1.0” encoding=”utf-8”?>
xmlns:mx=”library://ns.adobe.com/flex/mx” width=”640” height:480”>
<s:Label text=”Hello World!” horizontalCenter=”0” verticalCenter=”0” />
Note: Apache Flex 4.8.0 is the first release of Apache Flex.