well are you using ColdFusion? AMFPHP?

----- Original Message ----
From: Derrick Anderson <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, June 9, 2008 2:36:26 PM
Subject: Re: [flexcoders] new to VO's, why won't this cast?


i do get the employee list from a database, and I tried putting RemoteClass 
metadata on the VO class with an alias- no luck- same error.

d.


On Mon, Jun 9, 2008 at 3:26 PM, Sherif Abdou <[EMAIL PROTECTED] com> wrote:

well are you getting this from a Database, if you are then you may be able to 
use the RemoteClass metadata?


----- Original Message ----
From: Derrick Anderson <no.way.this. is.in.use@ gmail.com>
To: [EMAIL PROTECTED] ups.com

Sent: Monday, June 9, 2008 2:12:48 PM
Subject: Re: [flexcoders] new to VO's, why won't this cast?


actually, the link was http://casario. blogs.com/ mmworld/2007/ 04/casting_ 
a_datag.html

it's a very simple example of exactly what I'm trying to do.

d.


On Mon, Jun 9, 2008 at 3:09 PM, Derrick Anderson <no.way.this. is.in.use@ 
gmail.com> wrote:

i've seen other examples of this working..

http://casario. blogs.com/ mmworld/2007/ 04/passing_ actions.html

i tried setting it a property at a time and that of course works- but i'll have 
to write much more code and it will be harder to maintain.

thanks,
d.



On Mon, Jun 9, 2008 at 2:59 PM, Sherif Abdou <[EMAIL PROTECTED] com> wrote:

Ok i think you can't do that since I am looking at Adobe Flex Professional 2.0 
wrox book and they have a similar example and what they did was
EmployeeVO.employee ID = objectName.employee ID;


----- Original Message ----
From: Derrick Anderson <no.way.this. is.in.use@ gmail.com>
To: [EMAIL PROTECTED] ups.com

Sent: Monday, June 9, 2008 1:51:08 PM
Subject: Re: [flexcoders] new to VO's, why won't this cast?


ok, here is EmployeeVO.as

package com.winn.vo
{
    [Bindable]
    public class EmployeeVO
    {
        public var employeeID:uint;
        public var roleID:Number;
        public var employeeTypeID: Number;
        public var employeeStatusID: Number;
        
    }
}

then in my mxml file i have a simple datagrid

<mx:DataGrid 
        id="employeeDataGrid" 
        width="100%" height="100%" 
        dataProvider="{ EmployeesModel. getInstance( ).employeesList }" 
        >
with a click listener

employeeDataGrid. addEventListener ( MouseEvent.CLICK, clickHandler );

and here is clickHandler

public function clickHandler( event:MouseEvent ):void
        {
            var testVO:EmployeeVO = EmployeeVO(event. currentTarget. 
selectedItem) ;
            Alert.show(testVO. employeeID. toString( ));
        }

and the selectedItem has these properties.. .

employeeID = 1830 [0x726]
employeeStatusID = 2
employeeTypeID = 1
mx_internal_ uid = "D3C...."
roleID = 3




On Mon, Jun 9, 2008 at 2:39 PM, Sherif Abdou <[EMAIL PROTECTED] com> wrote:

can you give me a bit of code and I'll look at it so i can compile the examples 


----- Original Message ----
From: Derrick Anderson <no.way.this. is.in.use@ gmail.com>

To: [EMAIL PROTECTED] ups.com
Sent: Monday, June 9, 2008 1:21:51 PM
Subject: Re: [flexcoders] new to VO's, why won't this cast?


i tried your first suggestion, the second one I had already tried- at least 
with this one I get an error

TypeError: Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] 
to com.winn.vo. EmployeeVO.

Still the same question though, the datatypes seem to be compatible- so why the 
error?

thanks,
d.


On Mon, Jun 9, 2008 at 2:07 PM, Jon Bradley <[EMAIL PROTECTED] l.com> wrote:



On Jun 9, 2008, at 1:54 PM, Derrick Anderson wrote:

var testVO:EmployeeVO = DataGrid(event. currentTarget) .selectedItem as 
EmployeeVO;


Maybe this will help:

var testVO:EmployeeVO = EmployeeVO(event. currentTarget. selectedItem) ;

or
var testVO:EmployeeVO = event.currentTarget .selectedItem as EmployeeVO;


good luck,

jon 

 

 


 
    


      

Reply via email to