--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Right. That's too much code to analyze, but generally, if you plan 
> to update a dataProvider programatically, do not use XMLList or 
> Array,as they do not dispatch the necessary events to update the 
> UI.  With XML, use XMLListCollection, then use that api to update 
> the data.  All should work as expected.
> 
>  
> 
> Tracy
> 
>  
<SNIP>

OK here is the modification, I added three fields and another
button to allow adding of players to the ArrayCollection.

This works exactly as needed but how do I send changes to the 
ArrayCollection back to a PHP script so I may modify my DB? 
If I send the ArrayCollection, how will it be seen by the PHP 
script, as an array?


   [Bindable]
   private var rosterInfo:ArrayCollection = new ArrayCollection();
 
   public function handleXML(event:ResultEvent):void
   {
     // Convert XML response to ArrayCollection
     for each(var s:XML in event.result.option){
         rosterInfo.addItem(s);
     }
   }
 
   <snip>

   // This function adds rows to the ArrayCollection, clears the
   // entry controls and scrolls the newest entry into view.
   public function addPlayer():void
   {
     if ((player_name.text.length > 0) ||
         (jersey_.text.length > 0)) ||
         (age_.text.length > 0))
     {
       (RosterList.dataProvider as ArrayCollection).addItem(
         {playerid: 0, 
          playername: player_name.text, 
          jersey: jersey_.text, 
          age: age_.text}
       );
       player_name.text = '';
       jersey_.text = '';
       age_.text = '';
       RosterList.selectedIndex = rosterInfo.length;
       RosterList.scrollToIndex(RosterList.selectedIndex);
     } else {
       Alert.show("Players may be entered with blank values");
     }
   }


Reply via email to