CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Ajax vs Flash

  1. #1

    Ajax vs Flash

    I am not trying to start a debate or anything. However I am very curious as to why anyone should write ajax vs flash. Having used both, it has been my observation that Flash can do everything that Ajax can. Plus you don't have to worry about writing browser specific code as you would using Ajax. What are the pros and cons? Thanks in advance!
    -- Brandon Fogerty
    Http://www.brandonfogerty.com

    "Not believing doesn't make something not true"
    May GOD Bless, Strengthen, Guide, Protect, and Reveal Wisdom to you Always!

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Ajax vs Flash

    You are comparing apples to oranges. AJAX and Flash can do similar things but they are nothing alike.

    AJAX is an implementation of Javascript, synchronously or asynchronously, with XML. It is not a language but simply a passing of data.

    Flash is also not language. But it is much more than passing of data. It uses ActionScript to create interactivity for a client machine. But also can be used as a mere graphic or video as designed within the IDE. Flash doesn't require any programming in order to run.

    What aspect of these very different objects are you attempting to compare?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3

    Re: Ajax vs Flash

    Sorry, let me better explain myself.

    I agree with you that AJAX is an implementation of passing data via xml.
    However, generally the reason people use ajax is so that their website will resemble a Desktop application. That is pretty much the point of passing the xml data within the form as opposed to making a request to another server and then reloading the whole page.

    Flash is capable of doing the same exact thing. The benefit would be that if you use flash, you don't have to worry about writing cross browser compatible effects as you would in javascript. Now I know that there are libraries like scriptaculous that greatly aid in the development of user interfaces along with ajax support. But at the end of the day, I just don't see any real benefits in using Javascript + Html + Ajax vs Flash. Both can pass xml documents. Both can handle guis although I am biased towards Flash when it comes to the feasibility of designing a user interface. As long as your browser is fairly new, it should support the ajax XmlRequestObject control. However the same argument can be made for Flash. Almost every browser now comes with the Flash plugin as a standard. I just don't see what the advantage is of choosing the html + javascript + ajax method.

    Sorry, I am not trying to create a war or anything. I am just very curious as to why it would be better to go the route of html + ajax vs flash route. Thanks in advance!
    -- Brandon Fogerty
    Http://www.brandonfogerty.com

    "Not believing doesn't make something not true"
    May GOD Bless, Strengthen, Guide, Protect, and Reveal Wisdom to you Always!

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Ajax vs Flash

    Well, I sort of understand where you are coming from...

    The use of one over the other will depend on many scenarios. Personally, I prefer AJAX for many reasons.

    1. The optimized performance of Flash depends on the speed of the machine on which it is running. Flash is relatively slow. Here is a list of things that tend to slow down Flash.
    • Large embedded objects (movies, large images)
    • Rendering of vector graphics. (setting to low quality is annoying)
    • Slow client machine. (and there are many still out there)


    2. Even though many clients have Flash installed, many of them are not kept up-to-date. Developers tend to use the latest Flash to make sites, this means that the user must upgrade.

    3. Security reasons. Flash has been found to be exploits in the past. It will continue to be in the future.

    4. Good roots. AJAX is a technology been in existence since the 90's. It has been standard and the standard was set high when it began.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Mar 2007
    Location
    Montreal, Quebec, Canada
    Posts
    185

    Re: Ajax vs Flash

    Quote Originally Posted by PeejAvery
    4. Good roots. AJAX is a technology been in existence since the 90's. It has been standard and the standard was set high when it began.
    Flash has been around since the 90's too .

    Personally I prefer AJAX to Flash for several reasons:
    • I don't have a copy of Flash. To use AJAX I just use a text editor.
    • AJAX isn't owned by anybody, I'm a bit of an open-source advocate, so AJAX is preferable to Flash in that respect.
    • AJAX doesn't require any special plugins. The browser needs to support it, but pretty much all modern browsers do so it's a non-issue.
    • Most important: AJAX is simple. With Flash I get all these bells and whistles to do all these fancy things like animations and playing sounds. AJAX addresses a single need: to interact with the server without refreshing the page. Also other libraries like jQuery make AJAX even simpler to use without adding much overhead.

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Ajax vs Flash

    Quote Originally Posted by IllegalCharacter
    Flash has been around since the 90's too .
    True, but that was very different from what it is now. AJAX has had very, very little mutation. Just more implementation.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    Jul 2007
    Location
    Sweden
    Posts
    331

    Re: Ajax vs Flash

    My biggest reason for implementing dynamic content loading/sending in JavaScript instead of in Flash is how well it integrates into a web page. If you look at my homepage (http://mezane.org/) you'll see a feedback form. It'll send the feedback dynamically without reloading the page if possible (using what most people refer to as "AJAX"). If the browser has no JavaScript support, or the browser is something you'd see Fred Flintstone use, it'll still work - using ye olde way of submitting a form. On top of this it is completely integrated into the rest of my website design. I can style it with CSS and it behaves the way the OS wants it to behave. With Flash, doing the same form would be overkill, less intuitive and less user friendly.

    I know you weren't thinking about web forms, but there are plenty of things that integrate way better into a web page if implemented as JavaScript rather than Flash.

  8. #8
    Join Date
    Mar 2007
    Posts
    20

    Re: Ajax vs Flash

    I also use Ajax and Flash, and Ajax is (to me) much much easier. Of course, flash can do anything ajax can do with a little bit of actionscript, but some users may not have flash. also, making ajax browser specific is not very difficult. you can just do something like this:

    Code:
    var xmlHttp;
      try
        {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
        }
      catch (e)
        {
        // Internet Explorer
        try
          {
          xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
          catch (e)
            {
            alert("Your browser does not support AJAX!");
            return false;
            }
          }
        }
    so it's really just a matter how much time you want to put into something
    Last edited by PeejAvery; July 21st, 2007 at 03:35 PM.

  9. #9
    Join Date
    Mar 2007
    Location
    Montreal, Quebec, Canada
    Posts
    185

    Re: Ajax vs Flash

    Or even better, you can use a library like jQuery:
    Code:
    jQuery.ajax({
        type: "POST",
        url: "myPHPFile.php",
        data: "param1=potato&param2=hello",
        success: function(response){
            //do something for the response function
        }
     });
    Which simply "calls" myPHPFile.php and receives the output of the file in the success function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured