Hi,
i guess that the idea behind it was that:
- lots of people know about array's
- implementing a dataprovider interface might be too much for some, if you just want to put a few names in a listbox - macromedia wrote some complex dataproviders for example to provide data from a webservice to a component - good oo principles dictate the use of an abstract feature such as a dataprovider to provide data to a consumer - the only logical thing since Array did not natively implement this dataprovider api is to do the mixin thing.

Im not really sure if the Initialize call is needed though, did you try it without? It might be that if you try it on an empty stage, you need to call Initialize, but if you put a datagrid or something you don't need to, because it already takes care of the dirty details.
Like i said im not sure, i didnt try it out ;)
greetz
Hans

At 07:47 PM 11/29/2005, Cortlandt Winters wrote:
Thanks a lot Hans,

Just after sending that message (and thus having tried everything that
seemed to make sense) I tried new Array() and it did work. Your explaination
makes sense and it is marked as an api in a note of the components language
reference, but then it's also described as a class. I understand the
mechanics of mixins, but it still makes no sense to me as to why something
would want to be like this. I guess the good news is that I still have lots
to learn.

Initialize isn't listed in the documentation, I'll do some searching and
find out if I can learn anything more about that. I think I need to forget
that as1 ever existed if I'm ever going to enjoy as2 in time to forget it
ever existed and enjoy as3.

Thanks again.

On 11/29/05, Hans Wichman <[EMAIL PROTECTED]> wrote:
>
> Hi,
> if i do this:
> DataProvider.Initialize(Array);
> and var layers = new Array();
>
> it works just fine. Don't know if this is the accepted way to go about it
> though ;)).
>
> As for as i know i thought DataProvider was some kind of adapter class for
> arrays not really meant to be instantiated on its own.
>
> greetz
> Hans
>
>
>
> At 06:56 PM 11/29/2005, Cortlandt Winters wrote:
> >Hi Folk,
> >
> >I can't believe I'm having trouble using a dataprovider, but well... I
> am.
> >If somebody could lend me a brain I would appreciate it. Mine apparently
> is
> >having some problems. Here is the most reduced case. This code is in the
> >main timeline.
> >
> >import mx.controls.listclasses.DataProvider;
> >
> >var layers = new DataProvider();
> >layers.addItem({guy:"a"});
> >
> >var thingtestLength = layers.getItemAt(layers.length);
> >var thingtestItem0 = layers.getItemAt(0);
> >var thingtestItem1 = layers.getItemAt(1);
> >
> >trace(layers.length); // returns "undefined"
> >// but this one which uses layers.length to get the item
> >trace(thingtestLength.guy); // returns "a"
> >
> >// these both just return undefined
> >trace(thingtestItem0.guy); // returns "undefined"
> >trace(thingtestItem1.guy); // returns "undefined"
> >
> >So the item is being filed with an "undefined" key.
> >I thought that maybe we needed to have a label and tried this as well,
> but
> >with the same results.
> >layers.addItem({label:"joe", guy:"g", data:"a"});
> >and
> >layers.addItem({label:"joe2", data:{thing:"a2"}});
> >with the same results
> >
> >Does this make sense to anyone?
> >
> >By the way I also tried
> >var thingtestLength = layers.getItemAt(layers.length-1);
> >as that is what is supposed to be the proper syntax, but that gets us
> >"undefined" as well.
> >
> >And of course I tried getLength() as well and I tried using
> >DataProviderClass as well in desperation. I also tried "dataProvider"
> with a
> >lower case d as that shows up syntax highlighted but then the compiler
> says
> >it cant find the file. It's been years since I've been this bewildered
> with
> >something not working. I even uninstalled and reinstalled flash thinking
> >that my configuration must be broken, but no. It seems to be me.
> >
> >Thanks for any thoughts.
> >
> >-Cort
> >_______________________________________________
> >Flashcoders mailing list
> >Flashcoders@chattyfig.figleaf.com
> >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to