I had an interesting discussion a few days back about Flex compared to the Flash IDE, to many people it appears as though Flash applications built with MXML are by definition very static and lacking real creativity. Don't quite agree with that, it might just be that the typical use case for Flex is Flash applications which are generally not very 'flashy' but focus more on functionality. That certainly doesn't mean it has to be that way. XML is not the most convenient format in which to build visual effects (certainly not for right-brainers) but, as Abdul Qabiz also mentions, Flex and the Flash IDE can complement each other very well.

One example is using the Flash IDE to generate assets for use in your Flex projects (which MXML can embed in the SWF at compile-time). If for example you take an Image tag and embed some SWF animation as its source you have the best of both worlds, a compelling visual experience and an object that you can still remains scriptable.


In a way Flex offers an additional layer of abstraction not only for ActionScript but also for the visual layer of your application.

Another thing I love with MXML is the way you can quickly set up effects (move, fade, resize) to run either in parallel, sequential or a combination of both. Particularly sequential effects are troublesome to script in ActionScript with having to set up listeners to wait for an effect to finish and move on to the next one.


  

  
    
      
      
      
      
    
  

  


The MXML code above defines an effect to run in sequence when the Image component is created. What the effect does is move the embedded SWF file by 100 pixels on the x and y axis over 1 second, next wait for 2 seconds then move it to x and y position over 3 seconds and finally fade it out over 4 seconds.

If you try to do it that in the Flash IDE you have two options, use the timeline -- easy to visually layout, a real pain to maintain if anything changes -- or script the animation which requires quite a bit of experience with ActionScript and at least five times as much code.

Its all very impressive stuff, just one day to go before we can try the public alpha of Flex Builder 2!

Posted
AuthorPeter
CategoriesFlex