We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


passing remote object between components

hallikpapa asked
Medium Priority
Last Modified: 2013-11-11
I have a main components where I create a remote object succesfully. I am trying to pass the remote object connection between components, and it's not showing up null.

Here is my main application page with the connection, and the Bindable var on the other component
gateway = "http://" + URLUtil.getServerName(Application.application.loaderInfo.url) + "/amfphp/gateway.php";
				conn = new RemoteObject;
				conn.source = "ChartService";
				conn.destination = "amfphp";
				conn.endpoint = gateway;
				conn.showBusyCursor = true;
                conn.addEventListener("result", onResultRemoteObject);
                conn.addEventListener("fault", onFaultRemoteObject);
//other component var
[Bindable] public var conn:Object;
override protected function onResultHttpService(e:ResultEvent):void
				var o:Object = conn.eventByDistrict();
//conn is empty, so it can't call the method

Open in new window

Watch Question

Where are you passing in conn to the 2nd component?


Ah. I thought it did it automatically by just making it bindable.

What's the best way to make a remote object sharable throughout the app?

No you need to pass it to the children.

Use a framework:

Cairngorm:  http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm;jsessionid=35C9C31E4451F9A38EB1FD81544EB387
Mate:  http://mate.asfusion.com/
PureMVC:  http://puremvc.org/

Or I guess you could make a static class which is how cairngorm does it if a framework seams to much right now.


Yeah, a framework is way too much for this simple test I am doing.

Would you mind showing a small code example of how this static class would work between the two components?
Then just import it where you need it.

import com.myApp.className

and use it like


It might need some mods to work but its a starting point.  I think its pretty bad practice because its effectively a global variable.

Or you could just pass it to the childern objects
package com.myapp
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.remoting.RemoteObject;
		public static var conn = new RemoteObject;
                                conn.source = "ChartService";
                                conn.destination = "amfphp";
                                conn.endpoint = gateway;
                                conn.showBusyCursor = true;
                                conn.gateway = "http://" + URLUtil.getServerName(Application.application.loaderInfo.url) + "/amfphp/gateway.php";
                conn.addEventListener("result", onResultRemoteObject);
                conn.addEventListener("fault", onFaultRemoteObject);

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.