![]() |
![]() |
||||||
|
|||||||
| Tags: return, would |
![]() |
|
|||
|
i created a function here is the code below. What i want it to return is the
results so i can bind it to any component like a combobox or a grid. I was trying to return return phpService.xmlEncode; but no dice didn't work. any ideas. public function phpResponse(pstMethod:String,srviceURL:String,usPr ox:Boolean,cursorStatus:Boolea n):void { phpService.showBusyCursor = cursorStatus; phpService.method = pstMethod; phpService.url = srviceURL; phpService.useProxy = usProx; phpService.send; } |
| Sponsored Links |
|
|||
|
Hi,
I don't think this function will return anything. The function will just return nothing and will finish executing once the send() call is made. The send() call is asynchronous and will invoke the result handler once the response is received from the server. You can try adding a result handler (assuming this is a HTTPService) and then bind the data to the combo box in the result handler. Please visit the URL below for details on how to add a result handler. http://livedocs.adobe.com/flex/3/htm..._2.html#193905 Hope this helps. |
|
|||
|
Here is a simple yet complete example of an HTTPService with result handler:
----------- SimpleDGService1.xml ---------------- <?xml version="1.0" encoding="utf-8"?> <data> <item> <food>butter</food> <category>condiments</category> <healthy>no</healthy> </item> <item> <food>honeydew</food> <category>fruit</category> <healthy>yes</healthy> </item> <item> <food>milk</food> <category>dairy</category> <healthy>yes</healthy> </item> <item> <food>yogurt</food> <category>dairy</category> <healthy>yes</healthy> </item> <item> <food>candy</food> <category>snacks</category> <healthy>no</healthy> </item> <item> <food>beer</food> <category>beverages</category> <healthy>no</healthy> </item> </data> ------------ SimpleDGService1.mxml ----------------- <?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="dataRequest.send()"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; [Bindable] private var resultObj:Object = new Object(); private function resultHandler(event:ResultEvent):void{ resultObj = Object(event.result); } ]]> </mx:Script> <mx:HTTPService id="dataRequest" url="SimpleDGService1.xml" result="resultHandler(event)" resultFormat="e4x"/> <mx ataGrid dataProvider="{resultObj.item}"><mx:columns> <mx ataGridColumn headerText="Food" dataField="food"/><mx ataGridColumn headerText="Category" dataField="category"/><mx ataGridColumn headerText="Healthy" dataField="healthy"/></mx:columns> </mx ataGrid></mx:Application> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise