Hi All, I'm trying to get the following remoteObject working with Actionscript. When I use the mxml it works great. But when I compile with the actionscript, removing mxml I get an error "Method does not exist." This doesn't make a lot of sense to me... I've also tried views.addEventListener(ResultEvent.RESULT, onViewsResult);
Still, no dice. I'm struggling to understand how the two are different. Thanks for your help. -bennybobw <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.controls.*; import mx.rpc.events.*; import mx.utils.ArrayUtil; import mx.rpc.events.FaultEvent; import mx.rpc.events.InvokeEvent; import mx.rpc.events.ResultEvent; import mx.rpc.remoting.RemoteObject; import mx.rpc.remoting.Operation; [Bindable] public var nodes:Array; public var views:RemoteObject; public function init():void { views = new RemoteObject(); views.destination = "amfphp"; views.addEventListener(ResultEvent.RESULT, onViewsResult); views.addEventListener(FaultEvent.FAULT, onFault); getNodes(); } public function onFault(event:FaultEvent):void { Alert.show(event.fault.faultString, "Error"); } public function onViewsResult(event:ResultEvent):void { nodes = ArrayUtil.toArray(event.result); } public function getNodes():void { views.getView("test", ['nid','title','body','changed']); } ]]> </mx:Script> <!--<mx:RemoteObject showBusyCursor="true" destination="amfphp" source="views" id="views"> <mx:method name="getView" result="onViewsResult(event)" fault="onFault(event)" /> </mx:RemoteObject>--> <mx:Panel width="500" height="500" layout="absolute" title="Nodes" horizontalCenter="0" verticalCenter="0"> <mx:DataGrid x="10" y="10" width="460" id="nodes_select" dataProvider="{nodes}" > <mx:columns> <mx:DataGridColumn headerText="NID" dataField="nid" width="40"/> <mx:DataGridColumn headerText="Title" dataField="title"/> </mx:columns> </mx:DataGrid> <mx:Label x="10" y="200" text="Title"/> <mx:TextInput x="10" y="226" width="460" id="title" text="{nodes_select.selectedItem.title}"/> <mx:Label x="10" y="256" text="Body"/> <mx:TextArea x="10" y="282" width="460" height="75" id="body" text="{nodes_select.selectedItem.body}"/> </mx:Panel> </mx:Application>