I don’t read much. From disregarding instruction books on my Nintendo games to only touching the new <a href=”http://www.macromedia.com/devnet/mx/flash/”>DevNet</a> articles when I want confirmation in my hard won beliefs. I feel I learn better through doing.
So, I figured I’d give the DataProvider a try with the new components in F-two-Fo (F24/Flash 2004). I breifly scanned over the intructions as I couldn’t get a simple List to update with my DataProvider’s information. I liked the simple way of setting it’s property to the DataProvider instance, but… it still didn’t work. Since they documented modelChanged, I thought maybe I had to broadcast it myself, or maybe subscribe the List as a event listener manually; no dice. After actually reading, it seemed I was doing everything correctly.
So, I naturally asked <a href=”http://www.erikbianchi.com/”>Erik</a>; if I can’t figure something out, and still can’t after actually RTFM, Erik is my first choice of help. After discussing last night’s <a href=”http://www.dayofdefeat.com/”>DoD</a> excursions while Erik pounded away, he reached the same point of “wtf” that I did. The DataProvider.as file was kind of whack too.
Erik kept mentioning that he read and interpreted the docs as saying the DataProvider was nothing but an API; basically just an interface not actually holding any data (because the Array’s worked). I then re-read the 2nd paragraph if the List’s dataProvider description (I think that’s where it was). It turns out that the DataProvider simply extends the Array’s prototype so all Array’s now have the DataProvider methods (addItem, removeItem, etc). We tried it and it worked.
Why does weird shiot always happen on Friday’s?
So, in conclusion, DataProvider used to be a class in which to hold all of your data. Now, it’s just a (don’t know the pattern name) an API that’s added to Array’s. So you create an array, but use the DataProvider methods on that array.
Uh, yeah. If this is already covered on DevNet, whoop-pu-dee-dooooooooo…