
A while ago I joined the Flash CS5 pre-release program eager to test the iPhone packager that there has been so much fuzz about. After downloading the latest beta version of the Adobe Flash CS5 I started with some small and easy tests, to test the performance when running a Flash solution on an iPhone.
My first App consisted of an image of the iPhone “homepage” with some basic touch-behavior. Tapping the left side would make the image spin, rotating the Y-axis 180 degrees (.rotationY). Tapping the right side would spin the image the other way, while tapping on the top or bottom the image would rotate the X-axis (.rotationX). I used the Tweener-class to animate the rotation, using a “easeOutElastic” transition effect. The animations where of course quick and responsive on my computer, but how will the iPhone react to this? I worked very fine indeed. I tested on a iPhone 3GS and my old 3G. Both reacted as quick and responsive as it did on my computer. Nice! But hey, this was very basic…
I expanded my tests by using the new Accelerometer Class in AS3, making the image change its rotation-parameters according to how I held my iPhone. This also worked very well and my belief in the Flash iPhone packager continued to grow.
Time to build a real App!
Using a WebService that returns all contact info about the employees at Making Waves, I started to create an App that should present these data in an ‘iPhone-kind of way’. So I started off just like I would when creating a Flash solution, connected to the WebService, parsed the data and started to build a view. So far it worked like a charm on my iPhone. The view consisted of the employee name and department, three buttons, one to make it possible to call directly the person, one to send a sms and one to send mail. Finally it had a image of the employee. When the view is presented you should be able to switch between employees by swiping your finger to the left and right, just like you usually do it on an iPhone. To make it a little more interesting and different I made the view rotate its Y-axis when it is dragged according to how much it is dragged. The next and previous view/employee is automatically dragged according to the main view (take a look at the image on the top). The result was quite nice. Looking like a normal iPhone App but with a little twist. Using the TouchEvents that is new to AS3 was easy and combining it with the normal MouseEvents was no extra effort. Developing was quick and easy in a normal Flash development way, and I was thrilled to see the result on my iPhone. Time to put it to the test!
Since I didn’t have access to the iPhone 3GS I had to test it on my own iPhone 3G. The result was devastating. My first version was without the call/sms/mail buttons and the view of the first employee was presented pretty fast and it looked nice. But when I tried to swipe left or right the fun was definitely over. I worked but it was very slow. Performance was way under what is expected. I tried to read up on how to make performance to improve. GPU-rendering, cacheAsBitmap and so on. I added some functionality, improved the way to switch between views, tried to follow performance tips and tried again. Crossing my fingers and hoping that my last changes would do magic. Magic was unfortunately not the word. This time the app crashed each time I tried to start it. When trying to insert the image the iPhone didn’t want to handle the performance issue any more and shut down.
As a Flash developer I was really hoping that the Flash iPhone packager would be good enough to use to develop iPhone Apps in a easy and quick manner. The result after my first test was unfortunately as bad as they could be. I will not give it up just yet. There are probably a lot of things I could improve in my code to make it more iPhone friendly. At least I hope so! But one thing is for sure. Developing an iPhone App using Flash will not be the same as developing for the web. There is going to be a lot of issues to be aware of and as expected the performance issue will be the main issue.
I continue my test and will test my App on a iPhone 3GS when it gets available. I’ll try to improve it, I’ll do anything to try to prove that Flash CS5 will be a good platform to create applications for mobile devices. So far I have a long way to prove just that.
9 Comments
Hi Sven, was very interested to read your experiments using the Flash CS5 beta. I don’t currently have the beta but still interested in experimenting myself and see how it goes so any code and source you can share would be a great help. Thanks.
Thanks Jalileo. I will update this post with my further experience and try to include some source code samples when I get some new results. I have tried many performance improvements but still without getting the results I want…
Hi, did you have any trouble exporting it to IPA? I only get Error creating files. Usage error (incorrect arguments.)
Any tip? I have valid certs from my Mac.
Hi John. Only trouble I had exporting to IPA was when I had the App ID (under Deployment tab) incorrect. Make sure to include your full App ID path. Part from that the export worked fine. And of course make sure that the Provisioning profile includes your App ID.
Due to Apple’s new restrictions, making it illegal to produce iPhone Apps using Flash CS5, I have stopped my further experiments using Flash as a development tool for iPhone…
Hi, may I ask you a question? How did you connect to the WebService? In Flash CS3 and CS4 you can’t (not the fine way you did in Flash 8). Does Flash CS5 provide a way to connect to a WebService? Is there a WebService class again? Thanks!
Hi Loto. I used the WebService class. Here is some sample code from my experiments:
private function connectToWebService():void {_webservice = new WebService();
_webservice.addEventListener(Event.CONNECT, connected);
_webservice.connect("http://www.yoururl.com/yourwebservice.asmx?wsdl");
_webservice.cacheResults = true;
}
private function connected(e:Event):void {
// connected to webservice - now get some data!
_webservice.WebServiceCall(dataRecieved, "paramters");
}
private function dataRecieved(serviceResponse:XML):void {
// and the data can be collected here...
}
Hi Sven: are you talking about the WebService class hosted at Google Code? There’s no built-in WebService class in Flash CS series…
You’re absolutely correct. I’m using the alducente.services.WebService class…