Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

How to create single instance of an Remote object?

Avatar

Level 1
Hi,

I am using a remote object and its method to retrieve and
display some data in a datagrid.

The remote object has a method called getEmployeeList and I
have given it an id as "srv" in my mxml application.

But every time I make a call to that getEmployeeList method,
a new instance of that class(remote object) is created (and also
new values for its members).

But what I wnat is to have the same instance of remote object
per browser .

Is there a way to do this?

Pls. anyone suggest.
2 Replies

Avatar

Level 2
Hi,



Create your employee list as "public static" in another Java
public class. Get/Set the list from/to the public static class in
your RemoteObject instance. This may solve your problem.



Jeffrey



Avatar

Level 2
You'll want to set the 'scope' attribute on the destination
configuration in the configuration file remoting-config.xml.




http://livedocs.macromedia.com/flex/2/docs/00001130.html



The default is request which means that a new object is
created on each request.

If you use, session then a new object is created for each
session. I believe this is what you're looking for.

If you use, application then a single instance is used by the
entire application.