Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to retrieve result from an remoteobject AMFPHP Flex 4.5
    primarykey
    data
    text
    <p>I have a quick question about flex 4 remoteObjects. I would like to retrieve information from a MySql DB via amfphp to Flex 4.5. I'm using a remoteobject tag. I would like to use the result attribute but it doesn't seem to work for me. What am i doing wrong?</p> <p>If i collect the information form the DB without a resulthandler it works fine, but when i would like to collect the informatie in an arraycollection it doesn't work. The arraycollection never gets filled with the information i retrieve.</p> <p>This works;</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="initApp()"&gt; &lt;fx:Declarations&gt; &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt; &lt;mx:RemoteObject id="myRemote" destination="solicitantService" source="resume.solicitantService" endpoint="http://localhost:8181/amfphp/gateway.php"/&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ private function initApp():void { myRemote.getUsers(); } ]]&gt; &lt;/fx:Script&gt; &lt;mx:DataGrid id="myGrid" dataProvider="{myRemote.getUsers.lastResult}"/&gt; &lt;/s:Application&gt; </code></pre> <p>and this doens't work. </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="initApp()"&gt; &lt;fx:Declarations&gt; &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt; &lt;mx:RemoteObject id="myRemote" destination="solicitantService" source="resume.solicitantService" endpoint="http://localhost:8181/amfphp/gateway.php" result="myRemote_resultHandler(event)"/&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; [Bindable] private var users:ArrayCollection = new ArrayCollection(); private function initApp():void { myRemote.getUsers(); } protected function myRemote_resultHandler(event:ResultEvent):void { users = event.result as ArrayCollection; } ]]&gt; &lt;/fx:Script&gt; &lt;mx:DataGrid id="myGrid" dataProvider="{users}"/&gt; &lt;/s:Application&gt; </code></pre> <p>what am i doing wrong? can anybody help met out on this one? i have tried it with both the spark and the mx datagrid. </p> <p>Well i have found the solution. From Php i revieve an Array not an ArrayCollection. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload