You might prefer to use event.currentTarget.selectedItem.

Then your code will look something like this:

var position:Position = event.currentTarget.selectedItem;

Paul

----- Original Message ----- 
From: "arashafrooze" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, November 09, 2007 12:11 AM
Subject: [flexcoders] Casting in flex


> Hi,
> I'm a flex newbie, so please bear with me ...
> I have an advanced datagrid with a change property that calls a
> function passing it the event.
> inside the function i retrieve the selected row and cast it as an
> object. then i try to cast this object as, what i call a Position
> object. Even though both objects are identical in properties, My
> postion object does not get populated and is assigned NULL.
> I'm pasting the code to my function.
> Any help is greatly appreciated.
>
>
> public function updateSelectedPosition(event:Event):void
> {
> var position:Position = new Position();
> var selectedItem:Object;
> var selectedRow:uint = event.target.selectedCells[0].rowIndex;
> selectedItem = event.currentTarget.dataProvider[selectedRow];
> position = selectedItem as Position;
> }
>
> Thank you all so very much in advance :D
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
>
>
> 

Reply via email to