
Using Powerflasher FDT 4.1 and below to develop Android applications
To develop mobile Android application in FDT 4.1, we will need to configure FDT to enable access to a mobile Flex SDK. See the previous recipe if you have not yet configured FDT in this manner.
How to do it…
There is no specific mobile workflow or tooling built into versions of FDT prior to FDT 4.2. By taking the following steps, we can ensure that our project will be mobile-compatible:
- In FDT, right-click in the Flash Explorer panel and choose NEW | New Flash Project:
- The New Flash Project dialog will appear in which you must provide a Project name, and select whether to create the project using ActionScript 3 or Flex. We need to make sure to choose Flex 4, as this will include Spark components, which can be mobile-friendly if using a proper version of the Flex SDK.
- The next section will allow us to choose a specific Flex SDK to use in our project. We should choose a mobile-enhanced version of the Flex SDK for our Android project. Flex 4.5 and above include everything we need to begin developing robust Android applications.
- The last thing we must do is make sure that the mobile-enabled Flex SWCs are going to be used in our project. In order to declare
<s:ViewNavigatorApplication>
or<s:TabbedViewNavigatorApplication>
for the main container of our project, these specific SWCs must be accessible, else FDT will report errors. - The next section allows us to be sure the mobile SWCs are included. Select the tab labeled SDK Library and click on the button labeled Select SWCs…
- You will notice that
mobile\mobilecomponents.swc
is not included in our project. Select the checkbox next to this SWC and press the OK button to continue: - Now we will be able to use mobile specific containers and controls without receiving errors from FDT.
How it works…
When specifying which type of project we want to create in FDT, the program automatically makes available certain portions of the Flex Framework, so that we can work with all the components necessary for our project. FDT 4.1 and earlier do not ship with any mobile-enabled Flex SDK and do not provide a workflow for Android projects. Because of this, we must explicitly tell FDT to make use of the following extra framework components:
- ViewNavigatorApplication: This includes a
ViewNavigator
stack structure, in which we can push and pop different views to the top of a stack, exposing the topmost view to the user. - TabbedViewNavigatorApplication: This includes the ability to have multiple
ViewNavigator
stacks within an application, controlled through aTabBar
user interface element.
See also…
It is important to note that versions of Flash Builder prior to Flash Builder 4.5 will not include the ability to compile projects to .APK
(the Android application file extension) and you will need to compile your project using the freely available AIR SDK. See Chapter 11 for information on how to do this.
It is also worth a mention that while you can develop your applications for Android using older versions of Flash Builder, you will not receive many of the benefits provided by a newer release, such as code completion.