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:
Flex 4 uses a new namespace. The old namespace mainly referred to as the “2006 namespace” is as follows:
The new namespace mostly which referred to as the “2009 namespace” is composed of three namespace definitions, as follows:
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.
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
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.
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.
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…. 🙂