Home > Flash Builder 4, Flex, Flex 4 > Migration from Flex 3 to Flex 4

Migration from Flex 3 to Flex 4

Recently, I experiment on migration of Flex 3 application to Flex 4 application. And I plan to list out the possible situation which can create problems during migration of your existing Flex 3 application to Flex 4 application.

When converting Flex 3 applications to Flex 4, you might encounter the following issues:

1) Namespaces

Flex 4 uses a new namespace. The old namespace mainly referred to as the “2006 namespace”  is as follows:

xmlns:mx=”http://www.adobe.com/2006/mxml

The new namespace mostly which referred to as the “2009 namespace” is composed of three namespace definitions, as follows:

xmlns:fx=”http://ns.adobe.com/mxml/2009″

xmlns:mx=”library://ns.adobe.com/flex/mx”

xmlns:s=”library://ns.adobe.com/flex/spark”

Different files used by the same application can have different namespaces either 2006 or 2009, but you cannot have both namespaces in the same file.

2) Declaration

Non-default, non-visual properties must be wrapped in the <fx:Declarations> tag in Flex 4 applications.

3) Loading SWF files

The signature of the ModuleLoader.loadModule() method has changed from:

public function loadModule():void

To:

public function loadModule(url:String, bytes:ByteArray):void

Also, the SWFLoader class has a new property, loadForCompatibility, and a new method, unloadAndStop(). These changes were added in Flex 3.2, but if you are migrating an application from Flex 3 to Flex 4, you might encounter them.

4) HTML wrapper

The HTML wrapper has changed from Flex 3. There are several differences in Flex 3 and Flex 4.  The default output of the HTML templates is to center the SWF file on the page. In Flex 3, the default was to align the SWF file to the upper left corner of the page.

5) Globals

Top-level Application object is different in Flex 4. ApplicationGlobals.application has been replaced with FlexGlobals.topLevelApplication. Using Application.application is deprecated. FlexGlobals.topLevelApplication is the recommend alternative.

6) RLSs

The framework RSL is linked by default. This means that when you build an application SWF file, classes in the framework.swc file are not included in the application SWF file. The classes are instead loaded from the framework RSL before the main application loads. In Flex 3 the default was to statically link the classes. Using the framework RSL was optional.

The advantage of using the framework RSL is smaller application SWF sizes and faster download times. The downside is increased memory usage because all the framework classes are loaded in the RSL, not just the classes that your application requires.

Also there are several other differences in Flex 3 and Flex 4 which might be encounter during migration of Flex 3 project to Flex 4. I would like if you encounter any new things then please share it.

Enjoy RIA…. 🙂

Advertisements
  1. jonathan
    May 19, 2010 at 4:03 PM

    Hey do you have any example of using flex 4 with facebook? i could not get any decent flex 4 example as mostly or all of it is flex 3. Im a newbie too. Thanks

  2. jonathan
    May 19, 2010 at 4:04 PM

    Hey do you have any example of using flex 4 with facebook? i could not get any decent flex 4 example as mostly or all of it is flex 3. Im a newbie too. Thanks a lot

    • Bharat
      May 21, 2010 at 9:53 AM

      Hi,
      You can use Flex 4 with the same concept ( of Flex 3 ) for Flex – Facebook application, it dosen’t matter for the communication with Facebook if you are using Flex 3 or Flex 4. It will work fine.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: