The ESRI Flex API vs the JavaScript API

OK, I’ll come clean.  While Flex is a great tool, I can’t see how you’d not use the JavaScript API instead.  Flex is still not available on every platform (I’m an iPhone elitist) and isn’t easily picked up by everyone.  But more than one person said in last weeks thread on the JavaScript API that Flex was the way they are going.  I’m curious is there a rising groundswell in Flex or are ESRI developers just an outlier to the overarching movement toward JavaScript?  FlexBuilder 3 is at least $250 (Pro is almost $700) and I just can’t see people bothering to buy an

What part of the Flex API makes you choose it over the JavaScript API?  If people are willing to block Flash, don’t you limit your marketplace by going that route over JavaScript?

Flex.....Savior of the Universe

Flex.....Savior of the Universe

This entry was posted in GIS and tagged , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

44 Comments

  1. Posted October 20, 2008 at 5:17 pm | Permalink

    I have found from using the Flex API that rendering of graphics layers is smoother/faster and doesn’t have any cross browser issues (printing from IE in the javascript API). The Flex API seems to handle large numbers of features in the graphics layer better than the javascript api as well. I think each has their place, but I prefer the development with the FLEX API personally. I can also say the user experience seems slightly better as well, even though it is still in BETA.

  2. Posted October 20, 2008 at 6:42 pm | Permalink

    js can also be “turned off”. and you don’t actually need flex builder to develop flex apps (though i suggest it’s a good idea), the SDK, etc are free (btw doesn’t visual studio run $700US++?).

  3. Posted October 20, 2008 at 7:05 pm | Permalink

    @Paul: Well sure, I suppose you can turn off images as well.

    Honestly I can’t recall how much VS 2008 was, but I sure don’t use it when working with the JavaScript API. Flex is probably more closely related to Silverlight than JavaScript so I suppose that is a fair comparison. Of course Silverlight has .NET behind it to give it much more power than Flex could ever have, but if Flex is the “half” between .NET/Silverlight and JavaScript then maybe one can get lots of use out of it. But if you are just going to display simple slippy maps, I still say stay with JavaScript.

  4. Lefty
    Posted October 20, 2008 at 7:11 pm | Permalink

    Does someone have a good example of a good Flex mapping site? I’ve seen tons of great Javascript ones, but I don’t recall seeing a flex one (doesn’t have to be ESRI).

    I’m of the opinion that OpenLayers is the best mapping front end on the web and it is all Javascript.

  5. HereWeGoAgain
    Posted October 20, 2008 at 7:13 pm | Permalink

    Next to Manifold, Flex/Flash/ColdFusion developers are the most annoying folks around. OK guys, we get it, you are so much smarter than we are.

    I appreciate the education I get every time I experience your wonderful applications and your well thought out development environment.

  6. Dale
    Posted October 20, 2008 at 7:36 pm | Permalink

    I think the cross browser point that Adam made is a big benefit, the common runtime that the flash plugin provides takes away some of the nervousness around browsers and new versions thereof. In addition to this the gamut of other options that a Flex client then gives you is significant, i.e BlazeDS for remoting and messaging with Java servers etc. So if you wanted to move beyond just a plain vanilla map client and possibly integrate with other sources of data, Flex would be a great option. BlazeDS offers great improvements in performance.

  7. Posted October 20, 2008 at 9:47 pm | Permalink

    @james i was responding to your comment that flex builder costs “something” . and no, i don’t think flex is “more of a .NET or Java replacement”. btw your emailed comment & what appears here are different.

    i won’t argue about the “power” of silverlight until it gets enough penetration to matter.

    i suppose i would agree about simple maps & js (what the heck does “slippy” mean anyway?), but who of us wants to “build” those? in any case the borg of “simple maps” has added a flex API, so somebody besides us adobe-centric folks sees value in flex.

    @HereWeGoAgain huh?

  8. rob
    Posted October 20, 2008 at 9:52 pm | Permalink

    Flex isn’t “half” between anything and anything else. It’s a framework that runs on the Flash Player. ActionScript is the language that runs (very, very quickly, since AS3.0) on that VM, which also supports HD video, XML, AMF (a binary transmission format), bitmap manipulation, HTTP and Sockets, sound, 3D and so, so much more. It does all this using a plugin that weighs approximatly 2MB and lives on >95% of the PCs in the world. This is not a technology to be taken lightly. The plugin is available for Windows, Mac and Linux, with very little difference between each implementation.

    Flex integrates tightly with Flex Data Services, BlazeDS and opensource alternatives like Red5 for real-time communication and streaming. You might make the case that Flex is, in fact, stronger than Silverlight/.NET (I won’t, because I don’t know either of the latter) because of its maturity and the large opensource community that supports it. The SWF and AMF formats are now open, btw.

    Unfortunately, Flash is shamelessly abused by the marketing world to give us lame site intros and pointless menus that turn people away from its real potential. Interest is beginning to build in mapping with Flash/Flex, though. Check http://www.spatialkey.com and http://modestmaps.com for starters. Google and Yahoo are both offering AS3.0 versions of their mapping APIs too. If they recognize the value of Flash, others might do well to pay attention.

    (Disclaimer: I don’t work for Adobe, but I do work with Flash AND JavaScript, among others).

  9. Morten
    Posted October 20, 2008 at 11:22 pm | Permalink

    Regarding Visual Studio, remember that there are free Express versions that does almost the same thing as the full version (and what it doesn’t do, there’s almost always a free plugin that can do it for you)

  10. Posted October 21, 2008 at 1:19 am | Permalink

    As Morten said lots of free VS 2008 Express and for the most part I have found them able to do most of what I need when compared to my VS 2008 full blown install and much easier to install and deal with.

    On another note regarding Flex – you may not have the browser war, but you have the FLASH plugin version issue. I have a client who is using FLEX for one of their mapping projects (non-ESRI) using mapquest flex api. The issue they are having is for what they need to do they require the latest flash player. I’m not sure you can get casual users to download the latest and greatest flash player just because your site requires it.

    Granted it is slightly smoother than javascript.

  11. Posted October 21, 2008 at 2:21 am | Permalink

    @regina production flex 3 is aimed at player 9.x. there’s no reason to require 10 unless they’re using a beta flex (or the need the nifty version 10 3D, BIDI, etc. stuff) & if that’s the case then having that kind of user d/l & install s/w is kind of trivial.

    in any case, your html/whatever wrapper can require whatever version you want & “help” the user d/l it–it’s really not a big deal anymore (otherwise flash wouldn’t have the whopping amount of penetration it does), even gov officers here can do it ;-)

  12. Posted October 21, 2008 at 6:57 am | Permalink

    Paul, Actually it is 9 (I didn’t even know there was a 10 out). To be honest I’m not involved in that side of the project aside from feeding spatial query results to it, but they said something about issues with a lower minor version of 9 or something like that and in that case – it partially loads but not completely.

    In general I wouldn’t agree Flash print wise is completely guaranteed. I’ve had issues with Flash charting software that sometimes prints correctly in IE and not on Linux and so forth which forced me to switch flash charting package. I still ended up using flash charting of course. It isn’t so much of a browser issue but more of a platform one in those cases as I think the Linux flash is always a small step behind the windows one is my general sense.

    But I’m not a big flash user just a casual one – so I could very well be doing something wrong. I do agree as far as doing dashboard charting goes its still better than using javascript or java applets.

  13. Posted October 21, 2008 at 7:11 am | Permalink

    I do agree as far as doing dashboard charting goes its still better than using javascript or java applets.

    In my experience, i.e., my projects, GIS websites are mostly “dashboard” type charting, and maybe 10 or 20% GIS mapping. The map is just a navigation tool for the database. Thus, my focus is on tools that give really slick, easy, flexible access to database mining and charting. ESRI has always been awful in that regard, in my experience. I just stay away from it.

  14. KoS
    Posted October 21, 2008 at 7:45 am | Permalink

    Curious…can the Eclipse IDE be used in place of VS2008?

  15. Posted October 21, 2008 at 8:35 am | Permalink

    I wouldn’t be shocked to see Javascript blocking being even more prevalent than blocking flash. This addon is superb and suggested by just about everyone at the tech haunts I frequent.

    KoS I imagine there is a cheap/free plugin (initial search got me here). There always seems to be a plugin for Eclipse and a lot of them are very good (I do most of my Python development in Pydev).

  16. Posted October 21, 2008 at 8:43 am | Permalink

    We’ve recently made the business decision to develop with Flex as the front-end for our web mapping projects. A recent project that was “pure” Javascript including an unacceptable number of hours for IE debugging. In 2008, there has to be a better way.

    Our preliminary experience has been quite positive. For a data/backend-centric shop, it offers an easy path to non-generic look-and-feel interfaces without calling on the services of black-turtleneck designer guy. Also, the ability rapidly create custom interfaces for different user audiences enables us to efficiently follow through on the premise that simple, tightly focused web apps are a better value to a client than the single uber GIS- system-in-the-browser that sports every feature but intuitive usability.

    So while the big picture issues can be debated: Silverlight vs. Flash, no Flash on the iPhone, etc. but for us it makes a compelling business case for the next 12-18 months.

    Brian

  17. Posted October 21, 2008 at 9:10 am | Permalink

    @Lefty : rob already referenced 2 great examples of Flex mapping applications. I could add Geocommons Maker (built on top of Modest Maps I believe) and Geoclip.

  18. John Brosowsky
    Posted October 21, 2008 at 9:11 am | Permalink

    Anyone going the route of ArcGIS Explorer now that it has web browser support, for web mapping applications? I am not aware to what extent custom tasks are available to ArcGIS Explorer in the web broswer or can be executed programatically such as from buttons on your own UI controls, or how easy or difficult it is to wrap your own UI around the non-full-page-mode ArcGIS Explorer embedded in a web page. While there is certainly a big download and install of software to the local computer required, there is also with Flex and Silverlight ( or VE or Google Earth browser plugin for that matter) – and this at least gets you 3D mapping and that famous Google Earth / VE consumer oriented web mapping experience.

  19. Morten
    Posted October 21, 2008 at 9:18 am | Permalink

    KoS: Yes you can use Eclipse for Silverlight : http://www.eclipse4sl.org/ (by why would you :-) )

  20. Posted October 21, 2008 at 9:28 am | Permalink

    Flex is basically a development environment built around Flash 9, which has more market penetration than any other piece of software in history, even Windows. Flash 9 enables a really powerful virtual machine that is “safe” for the client browser and is completely integrated within every major web browser. It is what Java was supposed to be: a write once-run everywhere platform with a lot of built in functionality.

    For a simple slippy map use a Javascript based map controller. However if you want to display a few thousand lines, polygons and placemark icons then Flash has much better and more consistent performance across browsers due to the varying quality of Javascript implementations. Internet Explorer being notoriously slow and lacking in compatability.

  21. KoS
    Posted October 21, 2008 at 9:48 am | Permalink

    Thanks for the responses, Ben and Morten.

    Morten, tbh, I have no clue. :) All this internet mapping and programming is almost Greek to me. Right now I only read about it, not play around with it.

    Let me throw the question back(a knowledge gaining question). Why would some one not use Eclipse over VS2008 or any other IDE? Doesn’t one arrive at the same end product?

  22. Danny B
    Posted October 21, 2008 at 11:15 am | Permalink

    I thought I might chime in. I built an entire javascript application while I was waiting for the purchase of Flex Builder to be approved, then I ported the whole thing over to Flex. What I ended up with is a hybrid application (why not take the best of both worlds?).

    I’m using a flex map (which, btw, I agree performs MUCH better when it comes to graphics, zoom animations, etc.), however many of my tasks use the javascript API. Since both APIs speak JSON, I’ve written a single javascript function that handles both Flex and Javascript API callbacks. Data is passed back and forth using the ActionScript ExternalInterface.

    In fact, I’ve gone so far as to write a detection script that can shut off the flex map if the browser doesn’t support flash (i.e. iPhone), and turn on the javascript map.

    Overall, I chose flex (at least for the map)because I didn’t feel the user was getting the same experience across browsers. I hated the fact that zooming looked good in IE, but felt clunky in Firefox. With Flex, I get the same user experience across all browsers, almost gauranteed.

    For some reason, I keep ending up with these hybrid apps. My last one used ArcIMS for the speed of the dynamic data display, but all the identifies/queries/geocoding/tasks used ArcGIS Server.

  23. Posted October 21, 2008 at 11:48 am | Permalink

    We’ve built a Flex Web mapping API against Manifold and are quite happy with the results. Version 1 was done in Javascript, but the cross-browser issues became quite onerous. Flash was a no-brainer for its reach, graphics capabilities, and the promise of AIR as an additional delivery platform. So we made the switch.

    We did the original app in Visual Studio, then moved to Flex Builder for the Flash version. It is quite powerful, but I still prefer Visual Studio.

    One of our driving reason for choosing Flex was Adobe AIR. With Adobe AIR, you can develop and deploy more easily both to the browser and to the desktop. Anybody else leveraging Flash/Flex in this way? (besides Matt and his excellent Earth Browser http://www.earthbrowser.com/)

  24. Gady
    Posted October 21, 2008 at 11:54 am | Permalink

    After comparing the .NET Web ADF, JavaScript API, and Flex API, we went with Flex to replace our internal ArcIMS app. The main reason was performance: Flex had the fastest response in working with our cached and uncached services. Sure JavaScript can be used in more places, but just about all machines in our department have similar configurations. All we need is a web browser and Flash player, which installs automatically if the Flex app doesn’t find one. The smoothness of Flex is wonderful as well, and I didn’t have the resources to develop the entire surrounding webpage design on top of the map functionality to produce the same look-and-feel that Flex provides. The ease of development is a major plus.

    Someone asked for an example of an ArcGIS Server app using the Flex API: http://gis.cityofboston.gov/SolarBoston/

  25. Josh
    Posted October 21, 2008 at 12:03 pm | Permalink

    Had to chime in and echo B. Timoney’s sentiments. We’re developing a logistics/mapping web app using Flex front-end accessing Java servlets. We initially went the HTML-Javascript route for the front-end, with the help of Apache Velocity macros and YUI libraries, etc. But the painstaking development process with Javascript is mind-numbing to me. Lack of a GUI designer, prehistoric DOM traversal, ambiguous variable types, debugging in IE/Firefox (!?!?!) are just some of the reasons I dread JS development. I just can’t understand why a developer would choose a text editor/Web Browser combo for development instead of a dedicated IDE? Isn’t this why Flex and Silverlight were brought forth? Like Timoney said, it’s 2008, shouldn’t we expect development to be more productive? (I haven’t ruled out that I’m completely missing a tool that makes JS a breeze…if so, please forgive my ignorance.)

    At any rate, I lobbied to try Flex for both a stable development environment and true cross-platform deployment. We hit the ground running and can’t imagine going back.

  26. ChrisW
    Posted October 21, 2008 at 12:17 pm | Permalink

    @KoS:

    If you’re using Eclipse, you might want to look at MyEclipse IDE ( http://www.myeclipseide.com/ ), which is a pre-configured Eclipse with masses of extra plugins already set up for you: loads of J2EE tools, DB stuff , XML, HTML, Javascript and AJAX. Some of these are open-source, others are MyEclipse-specific.

    It’s based on a subscription model i.e. you pay $63 per year (for the Professional version – there’s a basic version for about $30) and you’re entitled to all the updates in that time. If you don’t renew, then the standard Eclipse stuff continues to work, but the MyEclipse-specific stuff is disabled. I’ve renewed every year so far, as I’m happy with the cost-benefit ratio.

    Sure, you can get most of these plugins free and install them yourself. But I reckon $63 is a good trade for many frustrating hours of my life that would otherwise be spent swearing at software.

    You can also install any other Eclipse plugins e.g. I’ve put PyDev into MyEclipse and it works fine.

    Anyway, you can get a 30-day trial download from the website above and see for yourself if it’ll do what you want.

  27. LawDog
    Posted October 21, 2008 at 5:09 pm | Permalink

    Another great thing about Flex is the open source community. It is very active, and as flex adoption increases, some really great products are being created.

    .net: WebOrb, Fluorine Java: blazeDS, GraniteDS, WebOrb, Red5 PHP: AMFPHP, WebOrb And some really great frameworks with advanced concepts such as dependency injection are availible in Mate, and Prana. Also PureMVC and Cairngorm(not so much) And for amazin graphics and skinning Degrafa is awesome

  28. Posted October 21, 2008 at 11:37 pm | Permalink

    Flex? One word: “Loading…” :)

  29. Posted October 21, 2008 at 11:57 pm | Permalink

    The ‘Loading’ issue is a real one, but it can be mitigated by using preloaders intelligently. Additionally, if like most people who use caching, the flash application will sit in cache and subsequent loads go much quicker.

    I really enjoyed the Solar Boston example that somebody posted, but it took about a half minute to load yesterday. I went in again today and it took four seconds.

    For enterprise applications this is rarely an issue and can be addressed through training. For consumer applications it becomes more critical.

  30. Kirk Mower
    Posted October 22, 2008 at 2:03 am | Permalink

    BTW – PaulH is probably the world authority on Flex based mapping with ESRI backends. He has done the hard yards building perhaps the first with the release of Flex 2 (builder has always run Eclipse by the way). As for the iPhone, well it is beyond me why Apple hasn’t extended open arms to the Macromedia/Adobe community previously – a lot of coders coders have switched to Macs using Flex and/or ColdFusion for development work. I see no reason why Mr. Jobs will not accept Flash on the iPhone – I am willing to bet it is ready to fly once the go ahead is given. If Adobe can open up to ESRI – and vice versa (eg. jeremy bartlett at ESRI) – I see no reason why Apple can’t – but perhaps they like GRASS ;-) Seriously, though, I suspect this more to do with the relationship with Google than anything else.

  31. Posted October 23, 2008 at 5:56 am | Permalink

    uh, you have to understand that kirk spent a lot of time mapping the antarctic so he’s got quite the sense of humor.

  32. Jarkko
    Posted October 24, 2008 at 2:48 am | Permalink

    There’s an ESRI demo which is done with Flex:

    URL Removed by admin

  33. Gady
    Posted October 24, 2008 at 7:10 am | Permalink

    @ Jarkko

    Thanks for posting that. I remember seeing it at the conference and thinking that if all web mapping applications looked like that, we’d all be considered artists. Just beautiful!

  34. Posted October 25, 2008 at 4:50 pm | Permalink

    We are building all of our new applicatons using the ArcGIS Server Flex API. As soon as our customers look at a demonstration, all of the other options appear obsolete.

    Here is an example of a Department of Education prototype that we put together with the Flex API Beta. It is being completely rebuilt over the next few months, but they decided to push it out right away.

    http://nces.ed.gov/surveys/sdds/ http://nces.ed.gov/surveys/sdds/ed/index.asp?st=NY

  35. Gady
    Posted October 25, 2008 at 7:30 pm | Permalink

    @ Blue Raster Thanks for posting those links! What great examples of how incredible this API really is. And it makes the above comment about the “Loading” irrelevant, because these are FAST!

  36. Brian R
    Posted November 3, 2008 at 6:21 pm | Permalink

    Perhaps a little redundant vs. comments already made; but to address your points from my perspective:

    1. Cost for the Flex Builder API; Seriously I believe that any organisation who is running ArcGIS Server should see this is as a non-issue. I don’t know our budget off-hand, but it’s easily in the hundreds of thousands specific to GIS hardware/software/etc – who cares about a few hundred bucks if it’s the right solution?

    2. JavaScript is in theory more portable than Flash; in practice I would much prefer to develop on Flash and run it anywhere Flash is supported versus the pain of debugging JS when doing anything remotely complex. Really your only argument for this is the iPhone and for the general case, basing your deployment upon a particular model of cellphone is just silly at the pace that market moves now. Flash is popular and it works well.

    That said, JavaScript does have its place and we are planning to utilize it as a component. I’m afraid I don’t agree with ‘X vs Y’ as an ultimatum when X and Y are mutually useable. For our organization; we are planning a combination of Flash and JS in a way that is mostly transparent to users. We may have some .Net but this remains to be seen and basically factors on whether there is anything we need to do that cannot be accomplished in Flex. Emphasis on need – we are not going to do .Net simply because it has capabilities we don’t care about.

    Flex/Flash’s role is in more targetted customized apps which have slightly more sophisticated features than we want to develop with the JS API.

    JS’ role is essentially allowing ordinary users to embed GIS viewers into the Intranet with very little training, very quickly, and very easily – essentially to supplant the practice of producing jpegs/pngs for intranet embedding.

  37. Posted November 7, 2008 at 7:31 am | Permalink

    I’m very excited about integrating maps with Flex. I have Flex Builder now and I’m looking forward to writing my first app in it.

    Someone asked for an example of a map with Flex. Check this out:

    http://spatialkey.com/

  38. Posted November 21, 2008 at 12:43 pm | Permalink

    Has anyone added graphics to their ArcGIS Javascript based maps? Nasty! Slippy maps are great, but, when you add a few graphics, panning around is like running your finger through molasses. Good example here:

    http://serverx.esri.com/arcgisjavascriptapi/codegallery/EarthquakePopulation.html

  39. Satheesh
    Posted November 25, 2008 at 3:01 pm | Permalink

    I work on quirky Javascript, prototype frame work, css and Web services on datapower. The combination is great for our application that integrates legacy systems and delivery through RIA. I don know the reason behind the choice of prototype over Flex which was what I was looking forward for. Later I found that it has its own advantages to make a playground ‘play’ where us Flex is bound to coordinates.

    Content, look and behavior that is where javascript is rocking. I would suggest ‘Flex’ for applications. Though it is painful to work on JS, the OOPS features are exciting.

    We will see 1998 technologies maturing to 2009-10 technologies and browsers becoming W3c compliant. Web will break out of the box for sure and freedom for us to choose.

  40. Posted December 23, 2008 at 7:49 am | Permalink

    For ease of development, the ability to quickly add advanced functionality and pure programming joy; there is nothing like Flex. I’ve been the Javascript, JSP, Flash route building mapping apps. All have their strengths. Now I’ve found Flex I’m not going back. True there are weaknesses; loading times potentially (if you bloat the swf), cost (but builder is hardly that expensive) ….

    We’ve built a bunch of cool Flex maps at flexmappers.com; blending video, imagery, rss feeds with slippy maps has never been easier!

  41. akelarre
    Posted December 24, 2008 at 1:41 am | Permalink

    Greetings from Spain! I’ve followed the whole thread and it is really interesting. I would like to describe the situation in Spain as far as I know. The main consumers, developers and clients of GIS are all in the public sector. Therefore, they are reluctant to adopt new technologies for many reasons. Hiring staff, platform stability and so on. I my opinion, the problem we have here (I do not know if that is the case there) is that we do not have enough good javascript or flex programmers. In the first case most developers really hate JS (they just use it validate forms, easy dhtml) and in the second case flex programmers come form design world and they cannot handle complex GIS applications. The lack of a friendly IDE for JS is hard drawback altough new IDE such as Netbeans and Eclipse offer great features to work with it. The situation is that programmers are not yet used to develop with these IDEs and they always try to escape to the server side.

    • Posted December 24, 2008 at 7:36 am | Permalink

      JavaScript IDE? Get to know Aptana and you’ll know one of the best IDEs out there period probably because it is based on Eclipse.

      http://www.aptana.com/

      Even has an Eclipse plugin if you’d rather go that way.

  42. Posted July 22, 2009 at 4:47 am | Permalink

    James. Always nice to read your blog.

    Flex development does not need the Flex Builder IDE. You can do with the free “FlashDevelop” IDE. It has good debugging capabilities and intellisense support but without the WYSIWYG frill. If you want to develop Flex applications in Visual Studio 2008,you can do with the free “Tofino” plug-in. Yes, you heard me right. You can develop Flex applications with Visual Studio:-).

    BTW, James. With ESRI getting closer to Microsoft and Silverlight (with MapIt), what do you think about the future of the ESRI Flex and JS APIs. Will they continue developing them or will focus more on Silverlight?

    • Posted July 22, 2009 at 7:03 am | Permalink

      ESRI will continue to strongly support FLEX. It will probably continue to be more “popular” than Silverlight for years to come.

  • License

  • Disclaimer

    The information in this weblog is provided "AS IS" with no warranties, and confers no rights.

    This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion and probably incorrect.

  • Meta