Monday, July 13, 2009

Spring ActionScript Configuration in Flash/Flex/AIR application

Just as we use the applicationContext.xml in java application where we map the classes to the objecys in the context file and mapping the variables in the class files to the properties in the configuration file, we can use a simialr methodolgy in our flex application and get the changes to the variable by just changing in the configuration file , without building or refreshing the application.

Here is the code sniplet which is used to achive the following :-
// spring actionscript config
var applicationContext : FlexXMLApplicationContext =new FlexXMLApplicationContext("config.xml");
applicationContext .addEventListener(Event.COMPLETE, onApplicationContextComplete);

protected function onApplicationContextComplete(event:Event):void
var appConfig : AppConfig = applicationContext.getObject("appConfig");
model.appConfig = appConfig;
resourceManager.localeChain = [appConfig.locale];


// HERE model.appConfig is the actionscript class which i have mapped to the object in my configuration file. file is as follows :-
public class AppConfig
// src path used as root to locate images, etc.
public var srcPath:String = "";

// locale for menu config path
// note: curently resource bundle properties locale from project compile options
public var locale:String = "en_US";

public function AppConfig()


The config.xml is as follows:-


The swc file which is used in the application can be created as follows :-
First download the source using a subversion client from the following url:

Step into the ant folder and execute “ant” to see the options. You can create a debug enabled version, a release, documentation. I created the debug enabled version with the following command. Of course you do have to have ant on your path. Do not forget to change the You need to change the FLEX_HOME parameter as described in the readme file that comes with the sources.

ant compile-main-debug

The swc file is created in the antbuild/compile/main/swc folder.

Use the swc created in the project libs folder and use this extra ordinary feture to load configuration from outside.


Ammaps in Flex

Here is way to implement ammaps in flex , i used swfloader to add the ammaps in my application as follows

var str : String = "assets/ammap.swf?settings_file=assets/ammap_settings.xml&data_file=assets/ammap_data.xml"


where i kept all the required files(swf/xml) in assets folders of my application.


Tuesday, July 7, 2009

Making Sharper Flex Application with Sharper Fonts

I am not a multi fan of using fonts in Flex , i had to put a very smaller font which was to be very sharp , Here is a example to add it , i tried it in my css but it can be done with setStyle Attribute too, here is the code sniplet and the result
Just define following in your css
src: url("../font/kroe0555.ttf");
fontFamily: StandardFont;
flashType: true;
color : #CCCCCC;
focus-thickness : 0.4;
font-size : 8;
font-grid-fit-type :subpixel;
font-sharpness : 1;
font-anti-alias-type: normal;
font-weight : normal;


Saturday, July 4, 2009

A great Flex Map Component Mercator.swc

Mercator Flash/Flex Component from Manfred Weber is the coolest map componet i have seen with such a cool features, to zoom, get center, lattitude,longitude with additional markers and distance lines , i tried to create the map and within minutes i created a realy cool map with color and populating the map from a xml.The component contains all countries of the world and additional 8000 cities + the corresponding latitude and longitude

Just I think he has not updated the SWC file for the markers...... i think he will do it soon check out the demo at


About Me