BaseClientRequestHandler calling other handler methods

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
manosint
Posts: 6
Joined: 24 May 2009, 06:42

BaseClientRequestHandler calling other handler methods

Post by manosint »

Hi,

I have :

public class xxxx extends SFSExtension {
.....
addRequestHandler("x1", h1.class);
addRequestHandler("x2", h2.class);
.....
}

h1, h2 are classes extending BaseClientRequestHandler

In the h1 class I want to call a method of the h2 class. How can I do it?

Thanks
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

In short, you shouldn't. You don't control instantiation of these handlers.
If a method needs to be "seen" from more than one handler it should be moved to another class that is accessible maybe via a getter from the main Extension class
Lapo
--
gotoAndPlay()
...addicted to flash games
tpenn
Posts: 95
Joined: 03 Aug 2010, 18:48

Post by tpenn »

If the method in h2 that you wanted to call were static, you'd also be able to call it, but without more knowledge of what you're doing I couldn't say if that were appropriate here.

Typically, I've done exactly as Lapo described for such needs.
manosint
Posts: 6
Joined: 24 May 2009, 06:42

Post by manosint »

Thank you
Post Reply