This talk mainly to Demo11 a simple explanation.
1, the first defined Hellojavaflex.java the class itself has nothing to say, this is very simple, is a Java class, there is a constructor can be invoked.
2, Remoting-config.xml configuration, this configuration file is automatically generated, need to use this configuration file to define Java class to make the flex client can invoke.
ID is used in Flex client invocation, the author recommends that the first letter of the class with the same name should be used for the maintainability of the program, the author suggests, not the stereotype.
Source is the path to this Java class.
<destination id="helloJavaFlex">
<properties><source>com.test.HelloJavaFlex</source>& lt;/properties>
</destination>
3, is the Flex client.
<mx:remoteobject destination= "Hellojavaflex" id= "Remotehello" ></mx:RemoteObject>
This destination must be consistent with the target entry defined in the top XML and is the target of the remote service.
This ID is used to invoke in Flex's as syntax.
Remotehello.hellojavaflex (Lognam);
So we basically have a basic understanding of how flex and Java communicate.
The RemoteObject component is an as class mx.rpc.remoting.RemoteObject that can access Java object methods encoded using the AMF (Action message Format). The destination of the component points to the target of the LCDs (blazeds) remote service definition, which declares the Java class that ultimately provides the service.
You can use the as code, or you can use the mxml tag in Demo11 to instantiate the RemoteObject component, set properties, and invoke methods to access the remote service.
RemoteObject's commonly used attribute IDs and destination are described above.
Common events for RemoteObject components are as follows:
Event |
Description |
Fault |
Fault event is invoked when a service call fails and the operation itself is not processed |
Result |
The result event is invoked when the service call returns successfully and the operation itself is not processed |
Article Source: http://wangyisong.javaeye.com/blog/400992