Adobe Flex 2 – Initial Thoughts

So I am always looking for ways to either improve my skills with my existing computer language skill set, or expand my tool set allow me to be more marketable to whatever company I end up working for. Recently. I decided to pick Macromedia (now Adobe) Cold Fusion back up; as I hadn’t developed with the language for about three or four years (not since version 5) so I was interested to see how the language had progressed alongside Flash ActionScript and with the recent merge with Adobe. It was quite interesting, but it introduced me to something new: declarative programming for Flash. That is, declaratively creating Flash applications. This eventually led me to Adobe Flex 2, which is what I am going to write briefly about below.

Flex 2, being declarative, is based on XML and is written using mXml. The basic syntax looks like the following:
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221; layout=”absolute”>
</mx:Application>

The application tag defines the application, as a whole. This encapsulates all other tags, including function scripts, controls, layout, navigators, and charts. Because, like Cold Fusion, the language follows a Java-like pattern such that the controls are very similar to Java. You have panels, buttons, labels, images, etc (most of the standard controls exist). It is general practice to encapsulate the controls within Panels, though this is not required. You will notice the layout attribute in the application tag. This defines how controls are organized. Using Flex Builder plug in for Eclipse, absolute is the best choice because you can use (x,y) coordinates to position controls. But several other modes are available including horizontal and vertical.

So what would Flex be good for, one might be asking. For the part it servers well as standard standalone applications, but the mxml documents tend to be compiled into .swf files, thus they could be embedded in standard web pages. This is an interesting idea, because developers for major websites, the developer must assume that JS is not available, or risk having “dead” controls on the page. The same case exists with Flash surrounding whether the plug-in is available. However, if the plug-in is available the developer need not worry about about browser differences. That being said, it is worse to have the plug-in not be available and thus the functionality not available to the user. So from this perspective, Ajax is the more flexible solution as simple JS tests can determine how the UI should be changed, to allow or disallow Ajax functionality.

In conclusion, both Flex and Ajax allow developers to increase the user experience for their websites. However, the limitations for Ajax are similar to the limitations with DHTML effects and Flash still relies on the availability of the plug-in to provide its functionality. Both are acceptable solutions for Asynchronous web page development, but in the end I would be more inclined to select Ajax as, at this point, I do not believe there is a way for Flash apps (created with Flex) to update DOM elements of the page, this may change as my understanding increases.

Below is a small Sample Application, to give a better idea of what Flex Apps look like:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml&quot; layout="absolute"
>
<mx:Script>
<![CDATA[
[Bindable]
public var theStates:Array = [ “AL”, “AS”, “AZ”, “NY”, “CO”, “CA”, “LA”, “PN” ];
]]>
</mx:Script>
<mx:ComboBox id=”cmbStates” dataProvider=”{theStates}” />
</mx:Application>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s