Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Ajax vs. Flash

  1. Feb 6, 2008 #1
    I have been playing around with a couple projects of mine on again, off again for about a year now. I was thinking of dabbling with some client side applications and wanted to get some personal opinions from anyone who has used Flash or Ajax. Can anyone give me some insight if they have had to choose between the two. Most of my applications are pretty generic DB front ends that I have used either, VB, C#, or a Java applet, but I have found myself about Flash w/ Actionscript. Any thoughts?
  2. jcsd
  3. Feb 6, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper

    They are fundementally failry different things.
    Flash creates a self contained program downloaded and run in the browser.
    Ajax is a set of techniques for allowing a web page to communicate back and forth to the server as parts of the page change.
    Think of flash as more a replacement for a Java applet.

    You can use Flash to stream content into a page, called Asynchronous Flash - and marketed as Ajax/Flash but it isn't really the same thing.
    If you are prepared to target windows only and don't mind being on the cutting edge your could look at silverlight - this is MS's competitor to Flash which lets you run a limited .Net app inside a browser.
    Last edited: Feb 6, 2008
  4. Feb 8, 2008 #3


    User Avatar
    Science Advisor

    Flash and Javascript/Ajax share many of the same capabilities (and actually had the same syntax as well, in Actionscript 1).

    Flash is widely available but a good rule of thumb is: if it can be done with javascript with good performance then use javascript. I would use Flash for drawing vector images, and manipulating audio/graphics. Flash 8 added some great image manipulation capabilities (e.g. you can specify matrix transformations to produce your own image effects/filters in real time).

    Multimedia in general should be done with Flash (or Silverlight when it gets there).

    In addition Flash has sockets - a very valuable resource. With flash sockets you can implement a stateful connection (i.e. where as in Ajax you have to query the server every x seconds, in Flash you can create a socket connection and have the server send data to the client whenever it needs to, there's two-way communication). There are some reverse-ajax frameworks that enable you to implement more socket-like connections in ajax - but these have some drawbacks.

    Java applets i would only use for some extreme needs (such as accessing the user's file system, hardware devices, or for cross-domain socket connections) because the JRE is a big download, and because even for some quite simple tasks you end up having to sign your JAR's, which generates certificate prompts and security warnings. Also two-way java to javascript communication is not the easiest thing to implement - same goes for dynamically adding java applets to html pages with javascript. Finally, there isn't great compatibility between JRE versions - something that works in 1.4.1 does not always work in 1.5 (from my experience).
  5. Feb 8, 2008 #4
    Thanks, that is some good input. I wasn't aware of the sockets in flash and I have a couple of applications in Java that make use of them. Good things to consider.
  6. Feb 8, 2008 #5
    Flash is very similar to Ajax, but one notable difference is that Flash loads slowly, while Ajax is better optimized for page use. (In my opinion)
  7. Feb 8, 2008 #6


    User Avatar
    Science Advisor

  8. Feb 8, 2008 #7
    Yeah, that statement really doesn't make sense.
  9. Feb 8, 2008 #8
    I meant page use as in webapps and such...sorry if it was misinterpreted. I just think Ajax works better for those types of applications.
  10. Feb 8, 2008 #9
    Where besides web applications would you use Ajax and Flash?

    I think the confusing thing was that you said that they're similar things, where one is a software product and the other is a programming technique. And it doesn't make sense to say that a programming technique is “optimized”.
  11. Feb 8, 2008 #10
    You're right, I didn't word that very well, sorry about that.
  12. Feb 8, 2008 #11


    User Avatar
    Science Advisor

    Not to mention that you can load flash asynchronously in layers or components, so load time between Ajax and Flash driven applications is not independent of implementation. One isn't better than the other in that aspect by default - it will vary according to the application and its implementation.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook