Issues with mx:method, mx.rpc.remoting.mxml.RemoteObject, and sub-classing mx.rpc.remoting.mxml.Remo
- by Ryan Wilson
I am looking to subclass RemoteObject. Instead of:
<mx:RemoteObject ... >
<mx:method ... />
<mx:method ... />
</mx:RemoteObject>
I want to do something like:
<remoting:CustomRemoteObject ...>
<mx:method ... />
<mx:method ... />
</remoting:CustomRemoteObject>
where CustomRemoteObject extends mx.rpc.remoting.mxml.RemoteObject like so:
package remoting
{
import mx.rpc.remoting.mxml.RemoteObject;
public class CustomRemoteObject extends RemoteObject
{
public function CustomRemoteObject(destination:String=null)
{
super(destination);
}
}
}
However, when doing so and declaring a CustomRemoteObject in MXML as above, the flex compiler shows the error:
Could not resolve <mx:method> to a component implementation
At first I thought it had something to do with CustomRemoteObject failing to do something, despite that (or since) it had no change except as to the name. So, I copied the source from mx.rpc.remoting.mxml.RemoteObject into CustomRemoteObject and modified it so the only difference was a refactoring of the class and package name. But still, the same error.
Unlike many MXML components, I cannot cmd+click <mx:method> in FlashBuilder to open the source. Likewise, I have not found a reference in mx.rpc.remoting.mxml.RemoteObject, mx.rpc.remoting.RemoteObject, or mx.rpc.remoting.AbstractService, and have been unsuccessful in find its source online.
Which leads me to the questions in the title:
What exactly is <mx:method>? (yes, I know it's a declaration of a RemoteObject method, and I know how to use it, but it's peculiar in regard to other components)
Why did my attempt at subclassing RemoteObject fail, despite it effectually being a rename? Perhaps the root, why can mx.rpc.remoting.mxml.RemoteObject as an MXML declaration accept <mx:method> child tags, yet the source of said class cannot when refactored in name only?