Subscribe to Tutorial Feed

Flash and PHP Bible

The Flash and PHP Bible has been released! The book can be found on Amazon or wherever fine books are sold in your area.

The Flash and PHP Bible has a forum for quick support.

Scriptplayground » tutorials » as » Building a Hello World iPhone App Using Flash CS5

Building a Hello World iPhone App Using Flash CS5

Learn how to build a quick "Hello World" iPhone app using Flash CS5.

You will notice many new features and additions in Flash CS5 but the one that stands out is the Packager for iPhone. Adobe has now given Actionscript developers the ability to create applications that can be sold and downloaded on the iTunes App Store* without ever having to learn Objective-C. All you need is a copy of Flash CS5, prior Actionscript knowledge and an iPhone Developer account.

* It is important to realize Apple has set steps in place to ban iPhone apps created using Flash CS5, however this article still is useful. The reason being you can still build your own apps and even use Flash for rapid prototyping and functionality tests.

This article will get you started using Flash CS5 to create iPhone applications on Mac and PC.

Note: While an iPhone Developer account is required to run, build and debug your applications on the iPhone, you can use the simulator included in Flash CS5 to test most of the features and functionality.

Before diving into the development process make sure you have signed up for an iPhone Developer Account and everything has been verified and approved. Also make sure you have iTunes installed on the machine you intend to use in order to install your iPhone applications once you build them. Finally, ensure you have downloaded and installed all of the necessary certificates and provisioning profiles in order to build and install your iPhone applications. If you have not completed this process please refer to the Flash CS5 documentation for step-by-step guides.

Building the Hello World App using Flash CS5

Once you have created and downloaded the necessary files you are ready to build your first iPhone application. Following the standard development process let's build the popular Hello World app.

Open Flash CS5 by Selecting "File > New" in the dialog, as shown in figure 1 and choose "iPhone OS".

Click OK to open a new Flash document. Once the Flash document is opened follow these steps.

  • Select the Text Tool (T) and create a text field on the stage.
  • Click once in the text field and type "Hello World!".
  • With the newly created text field still selected open the Properties Panel and ensure "Classic Text" is chosen. The placement and size of the newly created text field are not important, so you can pick whatever you prefer. However, for simplicity here are the settings, as shown in figure 2.

Save the file and Test the application "Control > Test Movie > In AIR Debug Launcher" or using the keyboard shortcut Cmd/Ctrl + ENTER. You should now see a preview of your "Hello World" application running.

Congratulations you have successfully configured and tested your first iPhone application using Flash CS5. Now let's build on this and test the app on your very own iPhone.

Compiling the app

Make sure you have installed the Provisioning Profile on your iPhone in order to install and run your app. You will not be able to install your own custom apps without the Provisioning Profile installed.

Start by opening the iPhone Publish Settings and filling in the following settings. Once all of the fields are completed click "Publish" to create the iPhone App file. This process may take a few moments but once you see an .ipa file appear in the directory you exported to, the process is completed.

Installing the app

The process of installing an app on your iPhone is accomplished by double-clicking on the .ipa file. This will launch iTunes and install the app in iTunes. Once your iPhone is connected to your computer, start the sync process and the app will be installed on your iPhone. If you see any error messages the most common cause is due to an incorrect Provisioning Profile or Certificate not properly installed. Verify these steps once again and try again.

Testing the app on the iPhone

Once your iPhone is synced the Hello World application should be installed. Simply click the app icon and you should see the text "Hello World!" on your screen, as shown in figure 3 below. You have now successfully created, installed and ran your first iPhone application and all using Flash CS5, pretty cool huh? Well, it only gets better. Lets now look at a real world application that is available on the App Store right now.

Closing Thoughts

There you have it, a way to use your Actionscript experience in building your very own iPhone apps. It is important to note there are a few limitations, but you will find most AS3 APIs are available and most iPhone functionalities. There are some exceptions with the initial release such as Camera/Microphone and In-App Purchasing. However, Adobe has assured developers they are committed to updating the Packager for iPhone moving forward and will be adding additional APIs as time goes on. For now get ready to build awesome iPhone apps and realize your Actionscript skill has just gained an additional advantage.

Follow Scriptplayground on Twitter (@scriptplay)

Comments: Building a Hello World iPhone App Using Flash CS5

 RenderedCanvas  Tue May 25, 2010 2:43 pm  
This is a nice tutorial however, this practice isn't applicable any longer for creating applications a disseminating them via the app store.
 mkeefe  Tue May 25, 2010 9:38 pm  
@RenderedCanvas - I do agree, and made sure to mention that clearly. However for prototyping this is very useful information.
 InternetApe  Thu Sep 9, 2010 11:56 am  
It is valid again! Apple is opening it up again.
 mkeefe  Tue Nov 9, 2010 10:00 am  
@InternetApe - Thats correct, I have been building a few apps since the ban was lifted. Look for updated tutorials on Scriptplayground for the iPhone/Flash development.
 Tom Armstrong  Wed Jan 26, 2011 2:24 pm  
I got to the end but hit this error:

Adobe Flash CS5
Error creating files.

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.


Any ideas how I can get around this?


 MaxD  Fri Nov 4, 2011 12:15 am  
I've got the same error and wasted the most of the day to find nice solution.

We need to add -Xms64M -Xmx512M java params here, but the way Flash invokes java makes it nearly impossible.

Download my java wrapper -
It deals with this error, just install to default location and you should be able to make IPA.
Add a comment
The ability to add new comments has been disabled in this archived version.

Main | Tutorials | Articles