RE: [SPAM] RE: [flexcoders] How do I get a property from a custom component?

2007-09-06 Thread Paul Steven
Thanks yet again Tracy for helping me along on my steep learning curve with
this Flex malarkey.

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: 06 September 2007 18:15
To: flexcoders@yahoogroups.com
Subject: [SPAM] RE: [flexcoders] How do I get a property from a custom
component?

 

Yes, the "evt_obj" target or currentTarget has a reference to the custom
component. Have a getter function in the component return the name.

I also advise passing in the entire item. It cleans up the code and provides
flexibility when you decide you need some other bit of item data in the
component or in the handler.

See below.

Tracy

Goal: Display a list of items using a complex display for each item, and
have each of those items behave like a menu element and respond to a click
anywhere on the item by running a handler function.

One solution is to use a Repeater with a custom component

In the main app or component, declare the Repeater, and the click handler
function.








And in the component, MyRepeaterItem.mxml:

 


[Event(name="itemClick", type="flash.events.Event")]







From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ]
On Behalf Of Paul Steven
Sent: Thursday, September 06, 2007 2:36 AM
To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
Subject: [flexcoders] How do I get a property from a custom component?

I have a repeated custom component as follows:
 

 


 


 

  
 
And I want to retrieve the studentName and productPrice when this component
is clicked on
 
private function CFSClick_Folder(evt_obj:Object):void {
 

var studentName:String = ?? 
 
}
 
Please can anyone tell me how I can get this value?
 
Thanks
 
Paul




 



RE: [flexcoders] How do I get a property from a custom component?

2007-09-06 Thread Tracy Spratt
Yes, the "evt_obj" target or currentTarget has a reference to the custom 
component. Have a getter function in the component return the name.

I also advise passing in the entire item.  It cleans up the code and provides 
flexibility when you decide you need some other bit of item data in the 
component or in the handler.

See below.

Tracy

Goal: Display a list of items using a complex display for each item, and have 
each of those items behave like a menu element and respond to a click anywhere 
on the item by running a handler function.

One solution is to use a Repeater with a custom component

In the main app or component, declare the Repeater, and the click handler 
function.

  

  
  



And in the component, MyRepeaterItem.mxml:

 
  
  
 [Event(name="itemClick", type="flash.events.Event")]
  

  
  




  


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Paul 
Steven
Sent: Thursday, September 06, 2007 2:36 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How do I get a property from a custom component?

I have a repeated custom component as follows:
 

   
 
    
   
 
    
    
  
 
And I want to retrieve the studentName and productPrice when this component is 
clicked on    
 
private function CFSClick_Folder(evt_obj:Object):void {
            
    var studentName:String = ?? 
 
}
 
Please can anyone tell me how I can get this value?
 
Thanks
 
Paul
        
 



[flexcoders] How do I get a property from a custom component?

2007-09-05 Thread Paul Steven
I have a repeated custom component as follows:

 



 




 




 


  

 

And I want to retrieve the studentName and productPrice when this component
is clicked on

 

private function CFSClick_Folder(evt_obj:Object):void {

 


var studentName:String = ?? 

 

}

 

Please can anyone tell me how I can get this value?

 

Thanks

 

Paul