13 Replies Latest reply on Apr 29, 2009 4:03 AM by Dileep123

    Web application and desktop application?

    Dileep123

      Hi everyone,

      I am new to this platform.I have a basic doubts that whats the difference between developing application in flex as a web application and desktop application from programming point of view?Can we use same code in both cases?

      Please guide me....

      Thanks

        • 1. Re: Web application and desktop application?
          ATIF FAROOQ Level 3

          Hi,

              The major difference between Air Desktop Enviornment and Flex Web Application Enviornment is how the sandbox is in effect in both enviornments.

           

          Web application cant read or write or manipulate any data on users localFile System without users interaction.So this Sandbox adds a barier for managing local databases as well . So for that we use client server enviornment for updating users interaction with the application on the server.

           

          But on other hand in  Air you have full control on users fileSystem.You can manipulate , maintain and arrange data in database managed localy on users filesytem. So in this way you save a round trip to the server for any filesystem operations.More then that Air applications behave like all other applications installed on your operating system you can update your air application add versioning system to your application and you also gain acces to OS level events . Like when  Your Application is closed Close Event Will be fired before Air Application is closed completly so this provide more control to developer to do operations that should be sticked with closing evnet . You can also add native drag and drop from your Operating Systems desktop to your application. In general Desktop applications have lose security then THe appilcations running in web Enviornment.

          • 2. Re: Web application and desktop application?
            Barna Biro Level 3

            Hi and welcome,

             

            The main difference between a web application and a desktop application is that web applications do not have access and can't manipulate your local system ( you can't open a window that displays all your local files, you can't delete, rename, edit local files and so on ). Obviously, this is just one difference, there are many more ( the best would be if you google for "web aplication vs desktop application" because the same rules apply for 99% if not all the platforms you can find out there ).

             

            Desktop applications can have full control of your local system ( obviously, we have to take in consideration the platform we are using because since AIR is quite new in the desktop application field it is also more limited than other languages that have been used successfully to create desktop applications for years and year; like ce C# or C++ and so on ).

             

            Another important difference is that desktop applications usually need to be installed in order to function where on the other hand, web applications can run in the browser without you having to install the aplication you are about to view on your computer ( in some cases, like of the Flash and Flex platforms, you only require a "special player" that can display the content you are trying to access... for Flash and Flex applications you need the Flash Player installed for your browser ).

             

            So, before jumping into a project/platform you need to know your target. If you goal is to offer a fast, easy to access and no install required application to your users then you'll usually go with a web application. If your application needs to work with local files, maybe local databases, or it needs more control over the user's PC and so on, then you'll most likely go with a desktop application.

             

            With kind regards,

            Barna Biro

            • 3. Re: Web application and desktop application?
              Dileep123 Level 1

              Thanks Atif for your reply....but can u answer few more things..like...mxml

              coding and actionscript coding is same for both ?My mean, can we use same

              code for desktop and web application ?Or if differences are dere then please

              tell..

              thanks

              • 4. Re: Web application and desktop application?
                Barna Biro Level 3

                If you are using Flex Builder than you'll be using MXML and ActionScript 3.0 combined for both Flex and AIR applications ( MXML helps you build great GUIs extremely fast and you can also make it interactive while ActionScript 3.0 is usually used in combination with MXML because developers usually add the "program logic" and functionality by writing tons of code; then use MXML to define the interface elements and they separate the code from the MXML by writing it in ActionScript classes or files; this is a good practice because it results in much readable code ).

                 

                If you are using the Flash IDE to build projects then you'll be limited to ActionScript projects and AIR projects written in ActionScript. You can't use MXML in the Flash IDE, not can you create a Flex project in the Flash IDE.

                 

                In essence, everything is based on ActionScript 3.0. 90% of the coding you'll ever do will have something to do with ActionScript, you'll most likely use MXML for creating the user interface and maybe adding some simple interactivity.

                 

                With kind regards,

                Barna Biro

                • 5. Re: Web application and desktop application?
                  Dileep123 Level 1

                  Thanks Barna for your detailed explanation abt desktop and web

                  application...Actually I wants to know that from coding point of view whats

                  the main difference between developing desktop application and web

                  application?Can we use same cod for both application?

                  • 6. Re: Web application and desktop application?
                    Dileep123 Level 1

                    Can we use same code for desktop as well as web application...I will be

                    using flex builder,action script and mxml.....

                    • 7. Re: Web application and desktop application?
                      ATIF FAROOQ Level 3

                      no there is no difference at all.You can make same code to run in both enviornments . Unless you try to access any API specific for air to work in web enviornment it wont work because . Those apis are only meant to be used with air only not in flex web Application

                       

                      like  flah.filesystem is the air specific api so you should only use this if your developing with desktop .

                      • 8. Re: Web application and desktop application?
                        ATIF FAROOQ Level 3

                        no there is no difference at all.You can make same code to run in both enviornments . Unless you try to access any API specific for air to work in web enviornment it wont work because . Those apis are only meant to be used with air only not in flex web Application

                         

                        like  flash.filesystem is the air specific api so you should only use this if your developing with desktop .

                        • 9. Re: Web application and desktop application?
                          Dileep123 Level 1

                          Ok thanks Atif....I will be in touch with you...

                          • 10. Re: Web application and desktop application?
                            Barna Biro Level 3

                            Dileep123 wrote:

                             

                            Can we use same code for desktop as well as web application...I will be

                            using flex builder,action script and mxml.....

                             

                            If you'll be sticking to Flex Builder then yes ( at least, a large part of it ). You'll be able to use the same code for both web and desktop application ( but only when using Flex Builder; because if you use MXML in your project than you won't be able to import it into Flash IDE because the Flash IDE can't recognize MXML ). The only things you have to pay attention to are the classes you are using.

                             

                            If you create an AIR application ( a desktop application ) that works with the local file system and try to copy-paste the AIR project source code into a Flex project thatn you'll be dealing with tons of errors that can't be resolved. Why? Because, as I already mentioned, web applications can't work with the local file system so in order to make your application compile and maybe get some pieces of it to work in a Flex application, you need to delete/cut all the "AIR specific classes and code", stuff that Flex can't handle because it is not allowed to work with the local system.

                             

                            With best regards,

                            Barna Biro

                            • 11. Re: Web application and desktop application?
                              Dileep123 Level 1

                              Oh Thanks Barna.....Now I understood .....is there any reference  for air

                              classes and web classes ?Sorry for bombarding questions on you...I dnt hav

                              so much idea abt this platform...

                              • 12. Re: Web application and desktop application?
                                Barna Biro Level 3

                                No problem, don't worry. Your best friends are these two links:

                                 

                                 

                                Everything you'll see that has a little red triangle next to it ( this symbol: http://livedocs.adobe.com/flex/3/langref/images/AirIcon12x12.gif ) is AIR specific, meaning that you can only be used in AIR ( in desktop applications ). The rest can be used in all three ( ActionScript, AIR, Flex ).

                                 

                                With best regards,

                                Barna Biro

                                 

                                PS: A tiny observation: You need to know that ActionScript vs Flex have some differences too ( althought you won't be working with ActionScript projects as you mentioned ). There are Flex specific classes that usually can't be used in a "pure ActionScript" project. I said "usually" because if you are really insistent then you can somehow get the Flex classes to communicate and work inside a ActionScript project ( but it involves a lot of work and should be avoided ).

                                • 13. Re: Web application and desktop application?
                                  Dileep123 Level 1

                                  Thanks a lot Barna for your help.....