Seona,

The first thing I see is that you have not declared thisUser as a new User.
In your initial code, either do:
public var thisUser:User = new User();

...or in your function, do:
thisUser:User = new User();

... then follow with your thisUser.id code.

Another suggestion, though. On the Flex side, you have a User class created
to use as a VO:

>
> [Bindable]
>     public class User
>





... but the result of your service call is expecting an ArrayCollection:


        public function login(userDetail:

ArrayCollection):Boolean {
            if (userDetail.length > 0) {
               thisUser.id = userDetail.getItemAt(0).id as Number;
               return true;
            }
            return false;
        }

Is UserDetail really an ArrayCollection? What's happening in your CFC
method? It appears as if you're passing a <cfquery> object, so I'm guessing
you're doing a query based on the login information, and returning the query
object directly.

While that will work, you should think about having a matching User object
the CF side. The signature needs to be the same as that of User.as, and
User.as will need an "alias" statement at the top which refers to the CFC
dot-delimited path. Check the CF docs about this. Fill the User.cfc with the
data from your query, send the User object to Flex, and it will
automatically be converted into an object of the User class. No
ArrayCollection stuff.

Alternatively, from your query, you can create a "typed struct," which
"pretends" to be a User.cfc. Like this:

<cfset userStruct = structNew() />

<cfset userStruct['__type__'] = "path.to.User" /> (Note the two underscores
on either side of 'type.')

<cfset userStruct['id'] = myQuery.id />

... and so on. Return the struct to Flex, and it will be typed as a User VO,
populated from CF.



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560

Reply via email to