10 Replies Latest reply on Aug 26, 2011 1:53 PM by Francisc

    Creating web page now, want mobile app later.  Best practices?

    sneakyimp Level 2

      I've been writing actionscript on and off for a long time now, but have always used the Flash IDE.  I'm hoping to build my next project using Flex Builder because I'm more of a code jockey than a designer.  I've got Flex Builder 3.

       

      I'm involved with a modest mobile game project.  We're hoping to build a simple game and it seemed logical to do a quick-and-dirty version of the game in actionscript so the project members and a select audience might be able to evaluate the game dynamics in a browser before we spend a gazillion dollars building the game for iPhone and Android platforms.

       

      It is my sincerest hope that I might develop my code in Actionscript and MXML and use this code to build mobile apps for iPhone, iPad, and Android without having to rewrite everything in Objective C or Java or whatever other language might be in play at the time we get it finished.

       

      Q1: Is this possible?

      Q2: Can anyone sketch out for me an overview of the process whereby one exports a Flex project to a mobile app platform?

      Q3: Can any seasoned developers tell me the big "gotchas" to watch out for?  For instance, I'd hate to incorporate a component that would not export to one of the mobile platforms.

       

      Any help would be greatly appreciated.

        • 1. Re: Creating web page now, want mobile app later.  Best practices?
          kokorito Level 4

          it is possible, but if you upgraded to Flash Builder 4.5 then its just as easy to do it for a mobile and not bother with a browser version (if its just for demo)

          to export to the device just click compile, tick android, add a certificate and click ok. Apple is similar but different certificate procedure (grrr, /me shakes fist at apple)

          as for components, FB 4.5 will tell you if its mobile optimised, if not might even suggest an alternative for you (not so sure about a pure as project, but I would think so)

           

           

          if you are going to spend a gazillion dollars then the first few should be an upgrade to 4.5

          1 person found this helpful
          • 2. Re: Creating web page now, want mobile app later.  Best practices?
            sneakyimp Level 2

            Thanks for the information. I am interested in getting FB 4.5, but before I spend $300 to upgrade, I'd like to be more sure of the mobile features one might access.  Can one access the camera in the mobile phone when building an app using FB 4.5?  What about GPS coordinates? What about programming for mouse clicks versus programming for a touch screen?  If I begin building my app in actionscript for ultimate export to Andoid or iOS I really don't want to build code for events that simply don't exist in the target platform.

             

            Also, I doubt that we'll want to skip the web page version of the app first.  I could be wrong, but I'm under the impression that distribution of applications to your testers' mobile phones can be a pain if you don't have it in the app store. The point of the web page is to encourage testers to come around and click without having to jump through hoops to get the app on their phones and then get installed, et. al.

             

            Also, there's the question of whether I can build the app once and have it sniff out the screen size (which can vary widely between different android phones or between a phone and an iPad) or whether I'll just have to build different versions of the app for each platform anyway.

             

            Anecdotes and more detailed discussion are welcome.

            • 3. Re: Creating web page now, want mobile app later.  Best practices?
              Francisc Level 3

              Hi,

               

              You can do all that with Flex on Android 2.2+ and iPhone 3GS, iPhone 4, iPad (1&2) and BlackBerry PlayBook.

              You really need Flex 4.5 and if I am not wrong you can get the SDK for Flex Builder. Mind, the SDK is open source (and so free), the IDE costs money.

              If you already have Flex Builder 3 and are looking to experiment, just get the SDK (if you can't find the link, I can search for it) and add it to Flex Builder.

               

              So, you can access camera, geolocation, rotation etc.

               

              Testing is more difficult on the iPhone but it's not Flex's fault.

              Testing on Android is a piece of cake, you can even test live directly on your mobile device connected through USB.

              1 person found this helpful
              • 4. Re: Creating web page now, want mobile app later.  Best practices?
                sneakyimp Level 2

                Thanks for your helpful post.  That's encouraging to know that I might be able to get the Flex 4.5 SDK without upgrading my IDE.  I'm a big fan of Eclipse and am considering trying to just use Eclipse with a Flex plugin. I certainly hope I might be able to download the latest eclipse and install a 4.5SDK plugin.  Might as well shoot straight for the latest SDK, right?  It would be great to avoid the $300 investment.

                 

                From your post, it sounds as though the Flex 4.5 sdk will be required for one to access the mobile phone features (gps, camera, accelerometer, etc.) which makes sense.  The ability to go actionscript->mobile was only recently announced.  Personally I think this capability is brilliant on Adobe's part.

                 

                I'm still wondering about the "best practices" aspect. Obviously the idea of a mouseover does not apply in the context of a touchscreen.  As I recall, the events exposed by Cocoa Touch (or other touch screen APIs/libraries) don't have the same Mouse/Pointer events as the AS3 that I know.  The point of this post (which is working well so far thanks for the input) is to try and make sure that I avoid building an app which uses features unavailable in a mobile context.  I'm starting to wonder if skipping the web page advice is being given because they mobile and web page paradigms are so different.

                 

                I still assert that the web page stage would be much easier to bring in testers -- meaning non-technical people who wouldn't know the first thing about installing an app on their phone. I'm talking about an audience of dozens or possibly hundreds and just can't provide them all guidance about getting the app installed.

                • 5. Re: Creating web page now, want mobile app later.  Best practices?
                  kokorito Level 4

                  I suggested not doing the web app because I thought it was just a demo, and maybe you didnt realise how easy it is to just do it on the mobile.

                  But yes, the views and inputs are different for web and mobile.But the data and logic can be the same, just have to have different views

                   

                  http://www.adobe.com/devnet/flex/samples.html

                   

                  this is an example of programming for multiple displays, ie the same basic project for web and mobile. They are apps rather than games but should give you an idea of how to do it (or one way)

                   

                  the top 3 reference applications. Check out the article that comes with them http://www.adobe.com/devnet/flex/articles/web-mobile-reference-apps.html

                   

                  Message was edited by: kokorito

                  • 6. Re: Creating web page now, want mobile app later.  Best practices?
                    Francisc Level 3

                    As far as I know, mouse and touch are handled as the same generally speaking in AS3.

                    Adding Mouse_Over or Click (etc) event listeners will also fire upon touch events.

                     

                    You also get extensive touch support though, you can listen for predefined gestures and even defined your own.

                    • 7. Re: Creating web page now, want mobile app later.  Best practices?
                      sneakyimp Level 2

                      Thanks for the links, kokorito.  Those look great.

                       

                      MASH thanks for your input.  Might you have a link documenting the mobile gestures available in the SDK?