Hi Jeff,
 
I do exactly what you are doing in Test 2, I duplicated this pattern from the Login example of the Cairngorm framework files. If you find a better way, let me know because it does add unnecessary extra work to wrap an extra value object around your array when that's all you want back from the server.
 
Regards,
Simon Fifield
-----Original Message-----
From: Jeff Krueger [mailto:[EMAIL PROTECTED]
Sent: 05 April 2005 21:56
To: [email protected]
Subject: RE: [flexcoders] Remote object that returns an array of objects

I use the UserVO within script in the application, not in the exact script,
but in other places. 

I was doing an alert with the typeof function.  I don't have a function but
I do have lots of public vars which come back undefined.  So I assume they
were not of the proper type.

I think I have a test case that should prove the class is available but I am
not sure.  I am using the cairngorm framework.  So in my command class in
the onResult class I can test these two sets of code.  Obviously I switch
out the java code to return the correct types to match the test.

Test 1 (Fails, but I do get the correct length array of 1 item)
var tempArray:Array = Array (event.result);
for (var i = 0; i<tempArray.length; i++)
{
      var tempUser:UserVO = UserVO(tempArray[i]);
      mx.core.Application.alert ("Test with userVo " + tempUser.userName);
}

Test 2 (Succeeds)
var temp:UserArrayVO = UserArrayVO (event.result);
var tempUser:UserVO = UserVO(temp.userArray[0]);
mx.core.Application.alert ("Test2 with userVo " + tempUser.userName);

Does that test make any sense or prove or disprove anything?

Thanks

Jeff


-----Original Message-----
From: Peter Farland [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 05, 2005 2:15 PM
To: [email protected]
Subject: RE: [flexcoders] Remote object that returns an array of objects



[snip]
Info: Serializing response
  (Message #0 targetURI=/2/onResult, responseURI=null)
    (Array #0)
      [0] = (Typed Object #1 'net.crownmedia.flex.user.vo.UserVO')
[/snip]

The AMF trace says objects are being sent back as Typed AMF Objects in
both cases... so now you have to determine whether the type is linked in
at compile time (this will depend on more than just an import statement
- you actually have to use the type somewhere in the script) so that it
is available at runtime.

When you said "the items inside the array are of type object" how are
you determining that they are just a plain old ActionScript object? Note
that typeof() in AS2 does not tell you the class name of an instance, it
always says object for anything that is derived from object.

Do you have a function on your ActionScript UserVO class that you can
call to check whether it was correctly instantiated as UserVO?




Yahoo! Groups Links









Yahoo! Groups Links

Reply via email to