While your code is technically correct (thus it works), since you are changing 
a [Bindable] property your compiled code will dispatch tempArray.length change 
events as you iterate through the tempArray. 

You can simply assign the event.result value to arrayDP.

[Bindable]
public var arrayDP:Array;

private function getDataListener(event:ResultEvent):void{
  arrayDP=event.result as Array;
}


or alternatively:

[Bindable(event="DPChange")]
public var arrayDP:Array;

private function getDataListener(event:ResultEvent):void{
  var tempArray:Array = event.result as Array;
 
  for (var i:int = 0; i < tempArray.length - 1; i++) {
    arrayDP.push( {name:tempArray[i].name,id:tempArray[i].task_id});
  }
  dispatchEvent(new Event("DPChange"));
}

Use the [Bindable(event="DPChange")] metadata tag, where you are telling the 
compiler that you'll be dispatching the change event, and dispatch it once 
you've iterated through the result array.
This might be helpful if you want to do client side processing on the data 
before displaying it.


Tibor.

--- In [email protected], "steveb805" <quantumcheese...@...> wrote:
>
> The solution was actually just to stay with the original idea of mine to keep 
> the dataProvider of the menu as an Array.  
> 
> In the result handler, basically I need to manually create A.S. objects with 
> the fields I want.
> 
> --------------------------------
> 
> [Bindable]
> public var arrayDP:Array = new Array();
> 
> private function getDataListener(event:ResultEvent):void {
>   var tempArray:Array = event.result as Array;
> 
>   for (var i:int = 0; i < tempArray.length - 1; i++) {
>      arrayDP.push( {name:tempArray[i].name,id:tempArray[i].task_id});
> 
> }
> 
> --------------------------------
> 
> Hopefully this is an aid to someone else.
> 
> ( If I'm wrong and need to go to Walmart to purchase a clue, let me know 
> though, but the popupbutton works now )
> 
> 
> --- In [email protected], "steveb805" <quantumcheesedog@> wrote:
> >
> > I've been trying like heck to get data returned from AMF Remoting and use 
> > it for the data provider for a popUpButton.  This data is from MySQL, just 
> > regular text fields/int fields, etc..
> > 
> > ---------------------------------------------------
> > 
> > public var dataXML :XMLListCollection; // the data provider
> > 
> > private function getDataListener(event:ResultEvent):void 
> > {
> >      var xmlResult:XMLList =  new XMLList(event.result); 
> >      dataXML = new XMLListCollection( xmlResult.children()); 
> > }
> > 
> > -----------------------------------------------------
> > 
> > My grasp of xml is kind of iffy, so I got mixed up while reading the Flex 
> > docs on xml.
> > 
> > Is this the preferred way of getting back the data.
> > Steve
> >
>


Reply via email to