Hi Harit,
In the the server, you have a User class for example
In this class, you have public properties

public string UserName { get return "abc";}
public string Password{ get return "xxx";}

In your flex, you get a list users
You only get username and password using line codes:

var us:Object = res.getItemAt(0);
var userName:String = us.UserName;
var passWord:String = us.Password;

Because of list of user in this case is array (Action Script) has length
property and order property. You can not cast array[i] object to User object

Regards,
Kiet VT


2008/11/1 Harit Kothari <[EMAIL PROTECTED]>

> Hi Keit,
>
> Yes. That's what I wrote. My point is to make understanding clear that why
> is it like this?
>
> The code that I have written is working. And if so, how can MXML get
> compiled if I refer username and/or password field from us (us:Object!)?
> username & password are public fields of User class (of ActionScript).
>
> The code is working. Just wanted help, if someone can clarify reason behind
> this.
>
> Regards,
> Harit
>
>
>
> www.printgreener.com - Millions of trees can't be wrong - please think
> twice before printing.
>
>
>
> On Sat, Nov 1, 2008 at 5:30 PM, kiet tuan <[EMAIL PROTECTED]> wrote:
>
>> Hi Harit,
>> You can not cast res.getItemAt(0) to User object.
>> you only use using us:Object = res.getItemAt(0);
>>
>> I tested already on .NET
>>
>> Regards,
>> KietVT
>>
>> 2008/11/1 harit <[EMAIL PROTECTED]>
>>
>>
>>> I have implemented a web service that returns ArrayList (Java) object
>>> from AXIS + apache tomcat server.
>>> I have implemented a method for my flex client to manipulate result of
>>> the WS call.
>>> Here it is...
>>>
>>> public function resEvent(event:ListUsersResultEvent):void
>>> {
>>>        var res:ArrayCollection = (ArrayCollection)(event.result);
>>>        var us:Object = res.getItemAt(0);
>>>        mx.controls.Alert.show(""+us.password + " " + us.id);
>>> }
>>>
>>> For ref. the java web service on server is returning ArrayList of User
>>> objects.
>>> I have User ActionScript class on client too.
>>>
>>> Everything's fine except that when I typecast var us:User = (User)
>>> (res.getItemAt(0)); it gives exceptions.
>>> Just declaring and assigning by var us:Object = res.getItemAt(0);, I
>>> am able to access public properties like id, password which are
>>> essentially belong to User class and not Object class.
>>>
>>> Can anyone explain reason behind this? FYI : The above method is
>>> perfectly working without any compile / runtime error!
>>>
>>> Thanks,
>>> Harit
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to