ALL_USERS isn't a collection of UserVO objects it seems. Looks like it's a
collection of generic Objects. How did you create the collection? Did you
use AMF? Did you load from XML? Somehow the objects that got created did not
get created as the proper UserVO objects. So check the collection when it
gets set, it's not getting set right. If you're using AMF then you might
need to include a reference to the UserVO class so the compiler knows to
include it, otherwise it won't get deserialized right. If you're using some
other method (like loading XML, etc) then make sure in the parsing of the
data that you are explicitly creating UserVO objects.

Doug

On Sun, Jun 1, 2008 at 6:35 AM, Manu Dhanda <[EMAIL PROTECTED]>
wrote:

>
> Hii
>
> am writing a simple application where for logging in, am checking the
> values
> against the value objects contained in an ArrayCollection.
>
> While
>
> if((evt.userVO.email == ModelLocator.ALL_USERS[i].email) && (evt.userVO.pwd
> == ModelLocator.ALL_USERS[i].pwd))
>
> returns true, then why it throws this Type coercion error at this following
> line:
>
> model.currentUser = ModelLocator.ALL_USERS[i];
> //UserVO(ModelLocator.ALL_USERS[i]);
>
> currentUser is type UserVO and ALL_USERS is a collection of UserVO objects.
>
> I had tried by explicitely casting the above line(as commented), but still
> the same.
>
> Here is the error, I received while debugging:
>
> Explicit casting:-
>
> TypeError: Error #1034: Type Coercion failed: cannot convert
> [EMAIL PROTECTED]
> to com.live.flats.vo.UserVO.
> at
>
> com.live.flats.commands::LoginInfoCommand/execute()[F:\xampp\htdocs\flats\flex_src\com\live\flats\commands\LoginInfoCommand.as:60]
> at
>
> com.adobe.cairngorm.control::FrontController/executeCommand()[C:\dev\swat\projects\ac_emea\Cairngorm\com\adobe\cairngorm\control\FrontController.as:215]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
>
> com.adobe.cairngorm.control::CairngormEventDispatcher/dispatchEvent()[C:\dev\swat\projects\ac_emea\Cairngorm\com\adobe\cairngorm\control\CairngormEventDispatcher.as:113]
> at
>
> com.adobe.cairngorm.control::CairngormEvent/dispatch()[C:\dev\swat\projects\ac_emea\Cairngorm\com\adobe\cairngorm\control\CairngormEvent.as:77]
> at
>
> com.live.flats.view::LoginPanelBar/loginUser()[F:\xampp\htdocs\flats\flex_src\com\live\flats\view\LoginPanelBar.mxml:29]
> at
>
> com.live.flats.view::LoginPanelBar/__loginButton_click()[F:\xampp\htdocs\flats\flex_src\com\live\flats\view\LoginPanelBar.mxml:74]
>
> Implicit Casting:-
>
> TypeError: Error #1034: Type Coercion failed: cannot convert
> [EMAIL PROTECTED]
> to com.live.flats.vo.UserVO.
> at
>
> com.live.flats.commands::LoginInfoCommand/execute()[F:\xampp\htdocs\flats\flex_src\com\live\flats\commands\LoginInfoCommand.as:60]
> at
>
> com.adobe.cairngorm.control::FrontController/executeCommand()[C:\dev\swat\projects\ac_emea\Cairngorm\com\adobe\cairngorm\control\FrontController.as:215]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
>
> com.adobe.cairngorm.control::CairngormEventDispatcher/dispatchEvent()[C:\dev\swat\projects\ac_emea\Cairngorm\com\adobe\cairngorm\control\CairngormEventDispatcher.as:113]
> at
>
> com.adobe.cairngorm.control::CairngormEvent/dispatch()[C:\dev\swat\projects\ac_emea\Cairngorm\com\adobe\cairngorm\control\CairngormEvent.as:77]
> at
>
> com.live.flats.view::LoginPanelBar/loginUser()[F:\xampp\htdocs\flats\flex_src\com\live\flats\view\LoginPanelBar.mxml:29]
> at
>
> com.live.flats.view::LoginPanelBar/__loginButton_click()[F:\xampp\htdocs\flats\flex_src\com\live\flats\view\LoginPanelBar.mxml:74]
>
> Any help would be great.
> Thanks.
>
> --
> View this message in context:
> http://www.nabble.com/Casting-Problem..-Type-Coercion-Failed-tp17585702p17585702.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>
>  
>

Reply via email to