When I was trying to serialize an object in Action Message Format (AMF) , I faced a problem in deserialized it which was null object value, after some goggling I found the solution:

I preserve the class (type) of any object before encoding in Action Message Format (AMF), so that it can be deserialized when decoding the object, so  If the encoding context did not register an alias for an object's class, the object is encoded as an anonymous object. Similarly, if the decoding context does not have the same alias registered, an anonymous object is created for the decoded data.

Finally we can register class using one of the following ways:

  1. using function registerClassAlias("path to your class", your class);

  2. using the metadata [RemoteClass(alias = "path to your class")]

Preloader Technical Problems

February 16th 2011, 3:17 amCategory: Flex 0 comments

Preloader is a custom class which allows developer to implement the loading page style of the application instead of flex default progress page.

Developer should take care of some problems when implementing Preloader

First Problem:

If developer uses any class of the project inside the preloader, this will cause the whole project to be loaded then the preloader will be shown next, if this happened the main use of the Preloader will be lost since the progress value will be 100%  because the whole application is already loaded.

Solution:

Developer shouldn't use any class or even any static variable inside it when implementing Preloader.

In case you want to do some action before your application exits you should do the following:

NativeApplication.nativeApplication.addEventListener(Event.EXITING , windowExitingHandler);

And take whatever actions inside the method windowExitingHandler()

If you have a collapsed component with height = 0 and want to expand this component and you don't know what will be the new height value. The only info you have is that you want to expand it. How will you set the new height value?!!

Easily:

var dumyNumber:Number; // just NaN mycomponent.height = dumyNumber; That is all :). But if you tried the following it will not work:

mycomponent.height = NaN; // won't work only assigned to a variable is valid

You can also set mycomponent.percentHeight = 100.

But what if you want to make a resize transition? In this case you must set heightTo value to NaN
My case was as the following: