Flex2 on the board

Posted in technology by pedro | Sunday, February 18th, 2007 at 10:54 am

Today my family went to kids-play. The children has unimaginable power. My wife is sleeping now, and I’m nearly sleeping too.

Introduction to Flex

Flex is based on adobe flash technology. Flex applications consist of MXML and ActionScript source files. For easy development you can try for 30 days Flex Builder. Flex Builder is built on Eclipse so everyone who use eclipse is familiar with. There are also Flex Data Service (integration with EJB, Hibernte, JMS and other data sources) and Flex Charting (charts).

The one hour ride on Flex.

Creating application is easy part. You have graphical designer where you layout components. It’s very similar to Swing application building. There is also event-listener mechanism. All properties You can set by properties editor, it’s very comfortable.

The heart of every application is MXML file. This is a normal XML file, which flex can convert on the fly to swf. The flex builder has very good mxml editor, it provides hints and auto-completes your code. Builder has a very good debuger, so you can easy debug your code to find out what’s going on.

You can create customer components and reuse it whenever you need. I think that you can find useful components on the web.

And finally flex has many WebService/XML integration. It’s very easy to create application connection to WS. For example, this code is a flex blogger reader from tutorial. This application connect to flex blog, read last post and shows them in table view.

The code:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”
layout=”absolute” creationComplete=”feeder.send()”>
<mx:HTTPService
id=”feeder”
url=”http://weblogs.macromedia.com/mchotin/index.xml”
useProxy=”false”/>
<mx:Panel title=”{feeder.lastResult.rss.channel.title}” x=”10″ y=”10″ width=”475″ height=”400″ layout=”absolute” >
<mx:DataGrid x=”20″ y=”20″ id=”posts” width=”400″
dataProvider=”{feeder.lastResult.rss.channel.item}“>
<mx:columns>
<mx:DataGridColumn headerText=”Posts” dataField=”title”/>
<mx:DataGridColumn headerText=”Date” dataField=”pubDate” width=”150″/>
</mx:columns>
</mx:DataGrid>
<mx:TextArea x=”20″ y=”175″ width=”400″ htmlText=”{posts.selectedItem.description}”/>
<mx:LinkButton x=”20″ y=”225″ label=”Read Full Post”
click=”navigateToURL(new URLRequest(posts.selectedItem.link));”/>
</mx:Panel>
</mx:Application>

The HTTPService object is responsible for getting posts. It simple get HTML page. Next we can access DOM objects. In our example rss.channel.title and channel.item (this one is a collection). It’s very easy.

Summary of Flex

+ Rich user interface
+ Eliminate page loads
- Depends on Adobe Flash 9
- Flex Builder is not free, building without builder is not easy than.

One Response to “Flex2 on the board”

  1. Aleksander Bienkowski says:

    It’s good for effective web pages. 30 days of trial version its enough time to write very nice web page with some java logic. So maybe its worthy to get involved whith it.

Leave a Reply

about me

My name is Sebastian Pietrowski. I've finished Warsaw University as Master degree. During my studies I started work for merlin.pl. The primary language I use is Java but I have also programmed in Python, Ruby and Scala. I worked as a technical solution architect at merlin.pl. infrastructure when we were moving from PL/SQL to J2EE. I engineering a great performance optimized solution that made the application 10 times faster than requirements and 85 times faster as original solution.

Currently, I am working as a Senior Expert at F.Hoffmann-La Roche to help define future roadmap in design and development of Enterprise software at Roche and Genentech and build adoption for new technologies. I'm continuously mentoring new developers, helping them understand how important test driven development is and empowering them to get better at their daily job. I'm involved in many activities which brings new technologies for better and faster development. You can find more details on my LinkedIn profile.

But don’t get me wrong, I am not your typical nerd. I'm a pleasant guy that you can drink a glass of wine with me and talk about a range of topics with. My leisure activities include playing basketball, soccer and listening to music. I try to be pragmatic while staying focused on application performance and tuning with success in my daily work.

My favorite quote from Yoda's and my life’s motto is: Do, or do not. There is no try.