PureMVC in a week

I decided to take my flex development to the next level and learn PureMVC framework in a week.

I will be:
– studying framework documentation.
– reading blogs, tutorials and forum posts.
– learning from source codes.

See my bookmarks, notes etc.

Multi-target applications

I recommend you watch MAX session where Matt Snow and Ali Ivmark are talking about applications that scale across devices: desktop, mobile, tv. They are talking a little bit about new platform Adobe is offering code name NITRO.

NITRO is a platform to design, build and deliver Flash widgets on multiple screens.

The definition of a widget is a small single purpose application that’s written in Flash, that an end user can place on the Web, the Desktop, on TV, on the Mobile Devices and is sharable.

View screenshots, Watch session

Converting Array of Objects into Hierarchical XML Data

In this example I want to show you how to convert array of categories and subcategories into hierarchical XML data.

Launch Demo
Jump into code

Create popup window and center on the second screen

Sometimes you need a way to create popup window from your application(WindowedApplication). In that case you could use code from my last post Center AIR Window on the screen. This code works just fine for windows(WindowedApplication and Window) running on the main screen. It wouldn’t work correctly in a case where main application(WindowedApplication) is running NOT on the main screen but on the second, third etc monitor. Below picture shows you just that, WindowedApplication is running on the second screen and popup window is center vertically and horizontally above it.

Jump into code

Center AIR Window on the screen

You might have noticed that Window or WindowedApplication doesn’t load in the center of your screen. By default, window loads somewhere in the left side on your desktop. I personally think, that this is a bad user experience and you should always center window vertically and horizontally on screen. You can do this by setting window x coordinate to (screen.width – window.width)/2  and y coordinate to (screen.height – window.height)/2.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    creationComplete="centerWindow(this)" viewSourceURL="srcview/index.html"> 

            import mx.core.Window;

            private function centerWindow(window:WindowedApplication):void
                var screenBounds:Rectangle = Screen.mainScreen.bounds;
                var nativeWindow:NativeWindow  = window.nativeWindow;

                nativeWindow.x = (screenBounds.width - nativeWindow.width)/2;
                nativeWindow.y = (screenBounds.height - nativeWindow.height)/2;


Auto select New Item in Tree component

There are plenty examples out there on how to add and remove leaf nodes from a Tree control at run time, one of my favorite is Working with tree controls tutorial by Adobe.

Now it’s time to learn more advanced stuff: auto select for new created item. This would be very easy to accomplish with List control. You would probably use ArrayCollection as a dataProvider, call addItem(item:Object), keep track of that item index, and then use list.selectedIndex = index. 

Unfortunately this is not easy with Tree control. Tree control could have opened and closed nodes. If the nodes in the tree control are collapsed, the selectedIndex is different than when all the nodes are expanded. Instead of using selectedIndex you want to loop through all nodes to find a new item’s index.

Jump into code

Launching external AIR application from the browser

Missing BitmapData class in code completion – Flex(FP10)

I’ve setup my Flex Builder for Flex 3.3 SDK and Flash Player 10 as described in this article. I noticed that BitmapData class doesn’t show anymore.

Any thoughts on this?

Above Problem Solved. (Updated)

Read the Flex 3.3 SDK

You need to:
1. Download Flex SDK zip file.
2. Uninstall current Flash Player.
3. Install Flash Player from /runtimes/player/10/win/

Thanks to the Flex Community(Michael Borbor).


Downloading and Saving Images to the desktop with AIR

In this example i want to show you how to download remote image(jpg or png) and save it to the desktop.

Continue reading ‘Downloading and Saving Images to the desktop with AIR’ »

Flex 3 / ActionScript 3 posters in JPG format

Each file is about 4MB, 2639×3949 pixels. Download posters(zip file)

You can order a set of Flex, AIR, and ActionScript posters(2 feet by 3 feet) from Adobe website.

NOTE: you need to have an Adobe ID and a valid Flex 3 serial number to order them

PDF versions appeared again on http://flex.org/poster/posters.zip