I assume you're talking AIR rather than true Flex, right? Synchronous database queries were added in beta 2.
Michael Krotscheck Senior Developer RESOURCE INTERACTIVE <http://www.resource.com/> www.resource.com <http://www.resource.com> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ________________________________________________________________________ ____ This email and any of its attachments may contain Resource Interactive proprietary information, which is privileged, confidential and may be subject to copyright or other intellectual property rights belonging to Resource Interactive. This email is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this email, you are hereby notified that any dissemination, distribution, copying or action taken in relation to the contents of and attachments to this email is strictly prohibited and may be unlawful. If you have received this email in error, please notify the sender immediately and permanently delete the original and any copy of this email and any printout. ________________________________ 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

