I used the Active Record CFC wizard to generate 2 cfc's - Users.cfc
and UsersGateway.cfc. I can bring in a series of records without a
problem using ArrayCollection but if I want to bring in just one
record using a "getByID" function in the CFC and then populate a
series of text input fields with the values (first name, last name,
etc) I am having a problem. Here is the code I am using:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="getData()" currentState="Account
Settings">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.collections.ArrayCollection;

[Bindable]
public var allusers:ArrayCollection;
public var currentuser:Users = null;

public function resultHandler(event:ResultEvent):void
{
allusers = new ArrayCollection(event.result as Array);
}

public function getUser(event:ResultEvent):void
{
currentuser = new Users;
}

public function getData():void
{
cf.getAll();
cf.getByID(3);
}


]]>
</mx:Script>

<mx:RemoteObject id="cf" destination="ColdFusion"
source="myproject.UsersGateway"
result="resultHandler(event)"
showBusyCursor="true" >
<mx:method name="getAll" result="resultHandler(event)" />
<mx:method name="getByID" result="getUser(event)" />
</mx:RemoteObject>

Later in the MXML document, I try to access a value using:

<mx:TextInput x="146" y="48" id="firstName"
text="{currentuser.FirstName}"/>

In the problems panel, I have the messages "Data binding will not be
able to detect assignments to "currentuser" and "Data binding will not
be able to detect assignments to "FirstName".

How should I go about setting the currentuser variable to be the
record retrieved by the getUser(3) command? and how should I call that
value in the Text Input field?

Thanks for any help. 

Reply via email to