Hi,

Now that web2py natively supports amf-rpc, I'd like to make use of it
but I need some guidance.

I want to use web2py with Flex 3. I know there is an example for Flash
and amf0 at http://mdp.cti.depaul.edu/AlterEgo/default/show/22,
but I was wondering if there exists and example for Flex 3.

I have a test amfrpc service at http://localhost:8000/rpc/default/call/amfrpc

I don't know what I should assign to the destination attribute of the
RemoteObject:

 <mx:RemoteObject id="remoteObj" destination="test"
endpoint="http://localhost:8000/rpc/default/call/amfrpc";>
                     <mx:method name="test" result="onResult(event)"
fault="onFault(event)"/>
 </mx:RemoteObject>

The full example for Flex that I took from the pyamf website follows
(I just changed some attribute values):

<?xml version="1.0" encoding="utf-8"?>
        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
                                        horizontalAlign="center" 
verticalAlign="middle"
                                        initialize="initApp()">
        
                <mx:RemoteObject id="remoteObj" destination="test"
endpoint="http://localhost:8000/rpc/default/call/amfrpc";>
                     <mx:method name="test" result="onResult(event)"
fault="onFault(event)"/>
                </mx:RemoteObject>
        
                <mx:Script>
                        <![CDATA[
                                import mx.rpc.events.FaultEvent;
                                import mx.rpc.events.ResultEvent;
        
                        public function initApp(): void
                        {
                            // This var holds the data we want to pass to the
remote service.
                            var param:String = "Hello World!";
        
                            // Call remote service to fetch data
                            remoteObj.test( param );
                        }
        
                        // Result handler method
                        private function onResult( re:ResultEvent ): void
                        {
                            var myData:String = re.result as String;
                            trace( myData ); // prints "Hello World!"
                            status_txt.text = myData;
                        }
        
                        // Fault handler method displays error message
                        private function onFault( fault:FaultEvent ): void
                        {
                            // Notify the user of the problem
                            status_txt.text = "Remoting error: \n";
                            for ( var d:String in fault.fault ) {
                               status_txt.text += fault.fault[d] + "\n";
                            }
                        }
                        ]]>
                </mx:Script>
        
                <mx:TextArea id="status_txt" fontWeight="bold" width="100%"
height="100%"/>
        
        </mx:Application>

Thanks.

-- 
Alexei Vinidiktov

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to