Thu 16 Mar 2006
In flex 1.5 when i in mxml i assigned a component a model i did not care if that model existed or not. it failed silently and flex did what it did, bound correctly and the rest. the 8.5 runtime is not so forgiving, and i like binding my models in mxml. hence i had to start using creationpolicy differently than in the past. now i only create object when i need them and when i have all the necesary information. in the past we would only look at creationPolicy when the view was rendering too slow due too many displayobjects being rendered at once.
anyway. in flex 2 if you do this
-
<s:SomeComponent creationPolicy="none"/>
then when you need the component you would do this
-
this.createComponentsFromDescriptors(true);
so whats happening in the background is the compiler creates code that looks something like this:
-
import mx.core.UIComponentDescriptor;
-
import org.lennel.descriptors.SomeComponent;
-
private function createSomeChildren():void
-
{
-
//I COULD NOT GET CUSTOM ARGUMENTS TO WORK
-
var args:Object = {};
-
var descriptor:UIComponentDescriptor = new UIComponentDescriptor(args);
-
// the object it will be attached to
-
descriptor.document = this;
-
//the class the descriptor is going to create for me
-
descriptor.type = org.lennel.descriptors.SomeComponent;
-
this.createComponentFromDescriptor(descriptor,true);
-
-
}
so if creation policy is set to auto all the descriptors are called at once, if Q'd in a Q, and well you should get the idea now. notice i use UIDescriptor.
see: livedocs