Instead of
ar = new ArrayCollection( rmObj.getFRData1.lastResult );
trigger a resultHandler function in the result event of RemoteObject
and capture the result there as following:
private function resultHandler(e:ResultEvent):void{
ar = e.result as ArrayCollection
}
HTH,
-Ravi
On Mar 22, 11:54 am, noel dcosta <[email protected]> wrote:
> Hi i am returning an array of VO objects from amfphp and assigning it
> to an arraycollection but not getting any values in it
>
> VOFortReportDisp.php
> <?php
> class VOFortReportDisp
> {
> public $serial_fr;
> public $realname_fr;
> public $sem_fr;
> public $section_fr;
> public $subCode_fr;
> public $subName_fr;
> public $lessonsCovered_fr;
> public $classesProposed_fr;
> public $classesHeld_fr;
> public $remarks_fr;
> // explicit actionscript class
> var $_explicitType = "org.VOFortReportDisp";}
>
> ?>
>
> VOFortReportDisp.as
> package org
> {
> [RemoteClass(alias="org.VOFortReportDisp")]
> [Bindable]
> public class VOFortReportDisp
> {
>
> public var serial_fr:int;
> public var realname_fr:String;
> public var sem_fr:int;
> public var section_fr:String;
> public var subCode_fr:String;
> public var subName_fr:String;
> public var lessonsCovered_fr:String;
> public var classesProposed_fr:int;
> public var classesHeld_fr:int;
> public var remarks_fr:String;
>
> }
>
> }
>
> require_once ('./vo/org/VOFortReportDisp.php');
> ...
> public function getFRData1()
> {
> //connect to the database.
> $mysql = mysql_connect(DATABASE_SERVER,
> DATABASE_USERNAME,DATABASE_PASSWORD);
> mysql_select_db(DATABASE_NAME);
> //retrieve all rows
> $query = "SELECT * FROM fortnightlyReport WHERE section = 'A'
> ORDER BY subCode";
> $result = mysql_query($query);
>
> $ret = array();
> $i = 1;
> while ($row = mysql_fetch_object($result))
> {
> $tmp = new VOFortReportDisp();
>
> $tmp->serial_fr = $i;
> $tmp->realname_fr = $row->realname;
> $tmp->sem_fr = $row->sem;
> $tmp->section_fr = $row->section;
> $tmp->subCode_fr = $row->subCode;
> $tmp->subName_fr = $row->subName;
> $tmp->lessonsCovered_fr = $row->lessonsCovered;
> $tmp->classesProposed_fr = $row->classesProposed;
>
> $tmp->classesHeld_fr = $row->classesHeld;
> $tmp->remarks_fr = $row->remarks;
>
> $ret[] = $tmp;
> $i = $i + 1;
> }
>
> mysql_free_result($result);
> return $ret;
> }
>
> [Bindable] public var ar:ArrayCollection;
> ....
> rmObj.getFRData1();
> ar = new ArrayCollection( rmObj.getFRData1.lastResult );
> Alert.show(ar.getItemAt(0).realname_fr);
> ......
>
> Alert.show(..) error is
> RangeError: Index '0' specified is out of bounds.
>
> If i assign rmObj.getFRData1.lastResult as a dataprovider to a
> datagrid i can see the results but if i use ar as dataprovider i dont
> see any values in datagrid
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" 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/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---