If you are not going to programatically update an individual data 
provider item, them XMLList will be fine.

However, if you ever want to have a user update a property of an 
item, in some editable cell for example, then you need to wrap the 
XMLList in an XMLListCollection.

This is because when you use the collection API to modify the data, 
events are dispatched to ensure the UI updates to match the data 
update.  This is similar to the relationship between Array and 
ArrayCollection.

There is no performance reason not to use a collection.  If you do 
not, then Flex wraps your XMLList or Array in a collection itself.

So, there are no reasons not to use a collection, except for one more 
line of code, and several reasons you should.

Performance caveat: It has become clear that accessing data an xml 
node is significantly slower than accessing data in a strongly typed 
object.  This can be noticable if you have, say, a large datagrid 
that displays hundreds of cells.

If this is the case with your app, then best practice is to pre-
process the e4x xml into strongly typed objects in an ArrayCollection.

Tracy

--- In [email protected], "Brad Bueche" <[EMAIL PROTECTED]> wrote:
>
> Thanks to this group, I have come a long way in understanding 
this.  I
> want to check my setup and see if I still have further to go.  Is 
this
> the preferred way to set up a dataprovider when pulling XML in E4X
> format via HTTPService?  Or do I still need to some how incorporate
> XMLListCollection here?
>  
> public var xmlService:HTTPService = new HTTPService(); 
> public var dataProvider:XMLList = new XMLList(); 
> 
> public function loadXML():void 
>         { 
>                 xmlService.url 
= "http://hostname/Data/createXML.php";;
> 
>                 xmlService.resultFormat = "e4x"; 
>                 xmlService.addEventListener(ResultEvent.RESULT,
> resultHandler); 
>                 xmlService.send(); 
>         } 
> 
> public function resultHandler(event:ResultEvent):void 
> { 
>     dataProvider = event.result.month; 
> }
>


Reply via email to