DataProvider in Flash 2004
I have been trying to use a Data Model in Flash 2004 and as I see, the implementation of DataProvider is different in Flash 2004 than Flash MX
The way in Flash MX was pretty straight forward:
// In Flash MX
myDP = new DataProviderClass();
This creates an array called items within the instance created.
Though this approach seems ok, similar approach does not work with Flash 2004:
// In Flash 2004
import mx.controls.listclasses.DataProvider
myDP:DataProvider = new DataProvider();
Now, I have come across a couple of ways to go about it.
- As described by Jesse: Using the initialize method over an Array.
mx.controls.listclasses.DataProvider.Initialize(Array);
This gets the job done, by adding all the methods of the DataProvider Class to the object prototype. However, what I dont like about it is, that it uses mixins. - I have come across a Vector class, made by 123Webwizard, similar to the one used in Java. This creates an array called data within the object it instantiates and works similarly as the DataProviderClass in FlashMX.
Now I am really dont know which is the better approach and why.
I personally would like to use the one which can be instantiated rather than using mixin simply as its easier to read and understand.
Would any one like to comment on the pros and cons....?
Also... will both the approaches work fine if the target player is Flash Player 6?




0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home