Wednesday, June 24, 2009

Pure Actionscript AIR Project in Flex Builder

Sometimes you want to create a small application and not bother with all flex/mxml stuff. Either it’s pure ActionScript, or it uses other framework than flex (yes, such thing exists!, for example ASwing or just V3 Components from CS3/CS4), you might want to set up an AIR project that starts from a simeple .as file.

Currently, there is no obvious option in the Flex Builder interface. But, as a matter of fact, it is quite simple. Create a FlexProject, select AIR - Desktop Application in the first screen and change Main application file from .mxml to .as

Then, add some code in the constructor of your main class:

public function ProjectName()
{
var win:NativeWindow =
new NativeWindow(new NativeWindowInitOptions());
win.activate();
win.addEventListener(Event.CLOSE, function():void {
NativeApplication.nativeApplication.exit(0);
});

win.stage.addChild(this);

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

graphics.lineStyle(1, 0, 1);
graphics.drawCircle(100, 100, 80);
}

If you already have a web application and want to create an AIR version of it, extend the main class with one that only adds the AIR hooks.

Tuesday, June 16, 2009

Top 10 Mistakes when building Flex Applications

For those new to Flex, check out recent Adobe Flex Basics to get a quick introduction to the framework and keep in ur mind following information when u working in flex....

In this post, Adobe’s James Ward teams up with InfoQ.com to bring you another Flex Top 10 (our most recent Flex Top 10). Flex is an open source application development framework for building rich Internet applications that run in the web with Flash Player, or on the desktop with Adobe AIR. Overall, Flex is a powerful framework that is easy to use, but today let's focus on some of the common mistakes that are made when building Flex applications.

To learn more visit:
http://www.infoq.com/news/2008/04/top-10-flex-mistakes

Some Other Links regarding Image galleries..

http://www.adobe.com/go/flex_photoviewer_app
http://www.flexer.info/2008/05/29/image-gallery-component-imagerail/

http://blog.flexexamples.com/2008/03/08/creating-a-simple-image-gallery-with-the-flex-tilelist