Perhaps set creationPolicy="none", then trigger a call to
createChildren() from the resultHandler.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of johantrax
Sent: Wednesday, October 31, 2007 12:25 PM
To: [email protected]
Subject: [flexcoders] Hold execution untill result from database

 

Hi all (again... I'm having a productive day ;) )

I'm trying to lift the creation of components to a new level (at
least, for me)
What I have: (if it is possible...)
1.
I have an .AS-class which describes a person. To keep it simple, the
person only has a name(String) and a photo(String - the URI).
2.
A/ I have a databasetable with the following structure
ObjectClass | propertyName | renderType
B/ Another database table as follows
renderType | bindPropertyName
3.
I have an AS-class(UICF) in my own lib, having following method
public static getUIComponent(object:Object, objectClass:Class,
propertyName:String, propertyType:Class):UIComponent
4.
I have a canvas

What should happen:
In the creationComplete of the canvas(4) a new Person is created:
var p:Person = new Person("Foo", "images/bar.jpg");
Now the canvas(4) calls the getUIComponent(3) for rendering the image:
var c:UIComponent = UICF.getUIComponent(p, Person, "photo",
String);
The method(3) returns the correct component, being an imagecomponent
and the canvas(4) just adds it to it's children:
this.addChild(c);

The problem is inside getUIComponent(3). This method should do a call
to my database to find out which type of component it should create
and which property to set. For this example, the db would look like
this:
First Table
ObjectClass | propertyName | renderType
Person photo Image
Second Table
renderType | bindPropertyName
Image source

However, if I recall correctly, all database requests made by Flex are
Asynchronous. One option I see, is to have a boolean which gets sets
by a resulthandler, and create a lock-up-loop in getUIComponent.
However there might just be another (better?) way, to wait for my
response and then create and return the correct component.

Thanks in advance,
--Johan

 

Reply via email to