Ely:
Thanks alot. Worked fine and I learned something about closures.
Dave

--- In [email protected], "Ely Greenfield" <[EMAIL PROTECTED]> 
wrote:
>
>  
>  
>  
> You've got three options:
>  
> 1) shove the id off into a member field, and grab it when the RO
> returns.  This is the least well designed response, since it can 
break
> in use cases where you've got multiple requests out and you don't 
just
> want last-out-wins.  Might be OK for your use case though.
>  
> 2) send the id up to the RO, and have it include it in the 
response.  A
> little wasteful, since the RO doesn't care about the id, but in 
general
> this 'cookie' pattern is a way to maintain state across RO calls.
>  
> 3) use closures.  you could do something like this:
>  
>  
> private function chartClickHandler(e:MouseEvent):void
> {
>     var id:String = UIComponent(e.currentTarget).id;
>     var roCB:Function = function(e:ResultEvent):void
>     {
>       nameList = event.result as ArrayCollection;
>       currentState = "showNames";   
>       gridPanel.title = id;
>       myRemoteObject.getNomeForNames.removeEventListener
("result",roCB);
>     }
>     myRemoteObject.getNomeForNames.addEventListener("result",roCB);
>     myRemoteObject.getNomeForNames(id);
> }
>  
> <PieChart id="..." click="chartClickHandler(event);" ... />
>  
> Ely.
>  
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of dffmyco
> Sent: Tuesday, September 05, 2006 8:28 AM
> To: [email protected]
> Subject: [flexcoders] Which chart was clicked
> 
> 
> 
> I have 3 pie charts which when clicked run the same remoteObject 
> method. Is there a way within the method that I can determine 
which 
> pie chart was clicked. I want to pass the id of the clicked chart 
as 
> a variable in the result function of the remoteObject method.
> 
> Thanks, Dave
> 
> <mx:PieChart id="Citrus" 
> click="myRemoteObject.getNomeforNames('Citrus')" 
showDataTips="true" 
> dataProvider="{citrusData}"/>
> 
> <mx:RemoteObject
> id="myRemoteObject"
> destination="ColdFusion"
> showBusyCursor="true" 
> source="fungaldatabases.fungaldatabasesstats.stats" 
> fault="Alert.show(event.fault.faultString, 'Error');">
> <mx:method name="getNomeforNames" result="showNames(event)">
> 
> </mx:method>
> </mx:RemoteObject>
> 
> public function showNames(event:ResultEvent):void{
> nameList=event.result as ArrayCollection
> currentState = "showNames"; 
> gridPanel.title = 'whould like to use the id of the chart 
> selected'
> }
>







--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to