Are you using CF 7.02? The version of CF you're using will influence
what solution you use.
But regardless, you need to create a bindable As class that the form
fields can be bound to like
[Bindable]
public class User
{
public function User()
{
}
public var FirstName:String = "";
public var LastName:String = "";
public var Email:String = "";
}
This object would be instantiated on your app start up. It needs to be
in a scope accessible by your form.
When you pull over your result from CF, you populate it with your data.
user.FirstName = event.result.FirstName, etc.
Your form elements would be already bound to the members of the user
object.
<mx:TextInput text="{user.FirstName}"/>, etc.
HTH,
Jeff
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of malik_robinson
Sent: Friday, January 19, 2007 1:56 AM
To: [email protected]
Subject: [flexcoders] Binding result from CFC to a Detail Form
Hi,
I am using a CFC here that has a method that accepts a userId,
it then runs an sql query and retrieves all the data associated with the
user like:
FirstName
LastName
Email, etc
I am trying to find out how I can set the form fields "text"
property equal to that of the Array that is returned from my
RemoteObject Call.
I have this code in my "main" application file. I did a trace
on the employeeDataArray and it has all the details for that user so the
remote call is working fine, I just cant figure out how to bind the
values in the array to the various form fields on "myForm" which is the
"id" I have given the form.
private function populateEmployeeProfileForm(
event:flash.events.Event ):void {
appViewStack.selectedChild=vs_EmployeeProfile;
employeeDataArray =
ApplicationState.instance.employeeArray;
// do I do this?? frmEmployeeProfile.myForm ???
didnt work for me
}
<mx:ViewStack id="appViewStack" height="100%" width="100%">
<mx:Canvas id="vs_EmployeeProfile">
<comps:globalToolBar id="globalToolBar"
width="100%" />
<forms:EmployeeProfile id="frmEmployeeProfile"
x="485" y="341" width="420"/>
</mx:Canvas>
</mx:ViewStack>
-Malik