Loading SVG content in Flex Apps

June 10, 2009

This is a question that is often asked to me. A lot of people have complex graphics done in SVG and want to leverage it in their Flex apps. Its actually quite simple.

Like any asset used in your app, copy the svg files into your project structure. You can use the Image control (mx.controls.Image) to draw SVG content. Just that the source has to pointed to classes containing the SVG content instead of the images as you do with JPG and PNG assets. Here is a small bit of code that generated the following result


<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221; backgroundColor=”0xffffff” layout=”horizontal”>
public var bird:Class;

public var tux:Class;

<mx:Image source=”{tux}”/>
<mx:Image source=”{bird}”/>


The SVGs I have used can be found here:


[Bookmark This Page] Aggregation of Flash Builder 4 Blog Posts

June 1, 2009

My colleague and good friend, Sujit  is aggreagating some of the very cool tutorials, articles and feature walk-through posts by the Flash Builder & Evangelism teams. Be sure you book mark it. You can see it here:


Connecting to WebServices with the Data Centric Development (DCD) feature in Flash Builder 4 – Part 3

June 1, 2009

This is Part 3 of a 3 part series:

This is a continuation posts about working with Web Services in Flash Builder 4. Here you can see the screen cast of the whole work flow that I described in the other 2 parts. To view the screen cast, click on the image below or download it here (right-click and select Save-As) 🙂

Click on the image above to see the screen cast

Connecting to WebServices with the Data Centric Development (DCD) feature in Flash Builder 4 – Part 2

June 1, 2009

This is Part 2 of a 3 part series:

This is a continuation of my Web Services import which was discussed in Part 1. Once you have imported the Web Service it’s time to build the UI and bind the service to it.

Step 3 – Building the UI

Go to the design view and drag and drop a ComboBox. Right click and click on “Bind to Data”.

This throws a wizard where you can choose the service you want to bind it to, which in this case is getCountries().

Click “OK” and run the application. You should see the following

Now lets get the population details for a selected item on the combobox. This is simple. Click on the ComboBox and click “Generate Details Form”

This throws a pop-up where you can choose which operation to call on change and what to display.

It automatically redirects to the code view and ask you to provide the parameter for the getPopulation() method.

So change

protected function comboBox_changeHandler(event:ListEvent):void

{ getPopulationResult.token = populationService.getPopulation(strCountry);}


protected function comboBox_changeHandler(event:ListEvent):void

{getPopulationResult.token = populationService.getPopulation(comboBox.selectedItem.toString());}

Now go to design view, reposition the generated Form and run the app and we have a fully functional application served by a webservice.  Just to make it pretty, I added a prompt to the ComboBox.

In the next part, you can see a screencast of the workflow that was defined in Part 1 & Part 2.

Connecting to WebServices with the Data Centric Development (DCD) feature in Flash Builder 4 – Part 1

June 1, 2009

This is Part 1 of a 3 part series:

Web Services are an integral part of the SOA infrastructure and also a preferred way of exposing services, especially in the Enterprise. The new Services Wizards feature in Flash Builder 4 makes it extremely simple to work with Web Services.

To work with the Services Wizard  which is part of the Data Centric Design feature in Flash Builder 4 ( for connecting to HTTPService, Web Services or Remoting using any back-end technologies like Java, PHP, CF… etc) you need to do the following:

  1. Add the service
  2. Configure Return Type (create client-side Model classes by inspecting the service)
  3. Call the service and bind it to UI Controls

Before I start to explain how to access Web Service (WS) from Flash Builder, let me discuss some aspects of the WS Architecture. A WSDL(Web Service Description Language) Document is what signify how a WS is exposed. On a high-level, each WS has the following:

  • Elements
  • Complex-types
  • Messages
  • Operations

Each operation will have an input & output message and each message may be built with an element or complex-types. We will be using this Population WS (click to see the WSDL file) for serving data to our application. We will use the following operations:

  • getCountries – to get the various countries for which data is available.
  • getPopulation – for getting the population of a selected country.

Let’s get started:

Step 1: Create Project

Begin by creating a new Project [File>New>Flex Project]. Type a name and press finish…

Step 2: Import the Service

In your Flash Builder 4 environment, you will see the new Data/Services Tab like below:

Click on “Connect to Data/ Service” and choose WebService from the pop-up

In the next screen, enter the Service Name (that you want it to be called in your Flex application) and path to WSDL file, which in this case is – [http://www.abundanttech.com/WebServices/Population/population.asmx?WSDL]

If your WSDL is SOAP 1.1 protocol compliant, it will directly show the operations screen (the screenshot after the one below). Otherwise, it will ask you to choose the appropriate SOAP port as below. Remember this screen will only appear if your WDSL is not WSDL1.1 compliant.

Then you can choose the operations that you are interested in. You can either choose just the operations you are interested in or press Select All and press “Finish”.

This will give you a Data/Services tab with all the operations imported and configured…

A moment to explain the above operation…

Flash Builder introspects the WSDL and the selected operations and generates the required classes. But you will notice that while the return type for getPopulation() is created as a client side model class called Population, getWorldPopulation() has a return type of Object. The introspecter does the following:

  • If the operation is well formed Flash Builder 4 creates the required classes (as in the case of getPopulation() method it creates a Population Class)
  • If the operation is not well formed then Flash Builder 4 keeps the return type as Object (as in the case of getWorldPopulation() Method)

Since WSDL itself defines the input and output types, it will create the required classes provided the operations are well formed.

The Part 2 of this series will deal with binding this service to UI and creating an application.

Learning Resources.pdf

July 17, 2008

Lately, I have been getting a lot of mails from people who want to start with Flex, AIR, BlazeDS..etc (The Adobe RIA Platform in short) and are looking for learning resources.

I have compiled a document of resources that I found most useful. This is in no way an exhaustive list, feel free to leave suggestions here and I will add it to the list.

Learning Resources PDF

ADC on AMP – A great resource for Flex Developers

July 9, 2008

We all are aware of the release of Adobe Media Player (AMP) which is built on AIR (and incidently in Flex). A lot of the popular networks like PBS, CBS, MTV and others have signed up with feeds for AMP. AMP is fast becoming a easier and more efficient way of content delivery for them and a better experience for the users.

Anyway, Adobe is also adding quite a few shows for AMP. One such very useful resource is the ADC (Adobe Developer Connection) channel. There all the adobe heavy-weights talkingabout how to do things effectively in Flex, AIR, Flash …etc

The latest talk is by our very own Ely Greefield, talking about Flex 4 and the way ahead.

You can catch the same content on tv.adobe.com, but the advantage with AMP is that you can save it and then view it at your leisure rather than having to be connected to watch it.

Go get AMP & Enjoy ADC 🙂