Adobe Dreamweaver Forums



Last 10 THreads :         Flash movie not working in html (Last Post : WEBDavid - Replies : 0 - Views : 1 )           »          load xml into mc symbols (Last Post : DigitalUprising - Replies : 0 - Views : 1 )           »          drop down menu over flash (Last Post : ltartisel - Replies : 2 - Views : 3 )           »          Flash-PHP Mail Form (Last Post : kglad - Replies : 3 - Views : 4 )           »          Flash Controls Not Displaying in Embedded File (Last Post : kglad - Replies : 5 - Views : 6 )           »          DW Flash Encoder (Last Post : wycn - Replies : 2 - Views : 3 )           »          navigation bar (Last Post : G. Rex - Replies : 5 - Views : 6 )           »          Adobe Flash 10 kills Wimpy (Last Post : ClubEXL.com - Replies : 82 - Views : 955 )           »          static sound (Last Post : 21n9 - Replies : 10 - Views : 11 )           »          flash loader reappears after movie plays (Last Post : kglad - Replies : 4 - Views : 5 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-25-2008, 04:13 PM
UberError
 
Posts: n/a
Diggs:
Default RemoteObject Event Listener Problem

I have a remoteobject which makes calls to functions like so

private function callRO(method:String, args:Object):void
{
this["m_ro." + method].addEventListener("result",
function(event){roResultHandler(event, method)});
this["m_ro." + method].addEventListener("fault",
function(event){roFaultHandler(event, method)});
this["m_ro." + method](args);
}

... where m_ro is my RemoteObject

I want to be able to cleanup the event listeners by removing them when the
result (or fault) is retrieved... I'm not really sure how to do this since I'm
passing multiple parameters

I'm assuming it would be something like:

this["m_ro." + method].removeEventListener("result",
function(event){roResultHandler(event, method));

(and almost the same for the fault)... but this does not work

I need to pass in the second parameter to my handler because I want 1 function
handle all results with a switch statement (based on the method).

Any help would be greatly appreciated!



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-25-2008, 06:02 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: RemoteObject Event Listener Problem


"UberError" <webforumsuser@macromedia.com> wrote in message
news:ggh7pq$hvm$1@forums.macromedia.com...
>I have a remoteobject which makes calls to functions like so
>
> private function callRO(method:String, args:Object):void
> {
> this["m_ro." + method].addEventListener("result",
> function(event){roResultHandler(event, method)});
> this["m_ro." + method].addEventListener("fault",
> function(event){roFaultHandler(event, method)});
> this["m_ro." + method](args);
> }
>
> ... where m_ro is my RemoteObject
>
> I want to be able to cleanup the event listeners by removing them when the
> result (or fault) is retrieved... I'm not really sure how to do this since
> I'm
> passing multiple parameters
>
> I'm assuming it would be something like:
>
> this["m_ro." + method].removeEventListener("result",
> function(event){roResultHandler(event, method));
>
> (and almost the same for the fault)... but this does not work
>
> I need to pass in the second parameter to my handler because I want 1
> function
> handle all results with a switch statement (based on the method).


Use a token instead. Since the token gets passed as part of the event, once
the event has been dispatched and listened for, it cleans itself up:

This post I wrote a week or so has links to the docs you'll need to get
started:
http://flexdiary.blogspot.com/2008/1...-remoting.html


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 12:36 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk