DataProvider is really cool but there are some events you need to know to make them much easier to work with.&
DataProvider is a Mix-in class that adds methods and events to the Array Class when a V2 list-based component is added into your application. There is no DataProvider class, per say, it just enhances Array to provide the methods and events needed to support a common data model for V2 components.
When you set the 'dataProvider' property in a component, the component subscribes to the events of the data array. This allows updates to the array data to cascade back to the component and update the view.
myArray = []
myArray[0] = {label:0}
myArray[1] = {label:1}
myArray[2] = {label:2}
myArray[3] = {label:3}
myList.dataProvider = myArray
The problems start when you modify the 'myArray' directly without going through the component or using the DataProvider methods. As follows:
myArray[4] = {label:4} //this will not show in the component!
When you use the component methods addItem, addItems, etc, they fire events within the dataProvider to update the view in the component. If you edit them directly via array methods, the component doesn't know the model has changed and this can leave the view of the component in a less than 'finished' state.
What we can do is fire an event directly when we make modifications to the dataProvider. This allows you to edit the array using all methods of Array and DataProvider and sync up the component view. Here is the magic:
myArray.dispatchEvent( {type:"modelChanged", eventName:"redraw"} )
Essentially the 'modelChanged' event, fires methods within the subscribed components directly. The cool part is that you do not need to know about the component instance and you can use the Array methods without breaking the component view.
Take a deeper look at mx.controls.listclasses.DataProvider.as for more on this event magic, there are lots of uses of the "modelChanged" event that are worth a look.
Cheers,
Ted ;)
DIGG IT! 
Easiest way to implement in your class:
import mx.controls.listclasses.DataProvider;
static var mixIt:Boolean = DataProvider.Initialize(YourClass.prototype);
// not the captital "I" on Initialize.
// it's lowercase on EventDispatcher,
// and he doesn't return anything
--JesterXL
--jesterxl@jessewarden.com
We can do this also:
1. Initialize the array as data provider:
import mx.controls.listclasses.DataProvider
var mixIt:Boolean = DataProvider.Initialize(Array);
2. Define an array:
dp = new Array()
dp = ['test', 'test2', 'test3']
3. Define dp as dataProvider for a list box:
list.dataProvider = dp
Now if you add items to your array by addItem() method, the changes are shown in the listbox:
dp.addItem('test4') //The list box will have 4 items
My post at:
http://www.arpit.net/blog/2004/08/dataprovider-in-flash-2004.html