|
In a nutshell, DataSelector is a mixin. A
mixin adds methods and properties to a class at runtime. Since you cannot
do multiple inheritance in ActionScript, using a mixin is a way around
that. DataSelector adds dataProvider powers to a class:
DataSelector.initialize(YourClass);
Any class that utilizes DataSelector gets a length
property. DataSelector gives a class pretty much all the DataProvider
methods (which are really proxies to the dataProvider it contains a reference
to), length being one of them. So:
yourComponent.length
is the same as:
yourComponent.dataProvider.length
Yes, modelChanged fires everytime you use a
DataProvider method on a dataProvider or dataProvider component.
a = ["one", "two", "three"];
yourComponent.dataProvider = a;
a.addItem("cow"); // fires
modelChanged
a.push("cheese"); // does not fire
modelChanged
yourComponent.addItem("moo"); // fires
modelChanged
ModelChanged actually has an object that is passed
to it, the event object, that has information about what changed. You can
use a switch statement to know what changed, and how, and more intelligently
draw your component. A note; this is a fuoi$%(*)$% load of work. If
you don't believe me, go look in DataGrid.as.
So, to be lazy, I just ignore it and redraw
everytime. Keep in mind, even if you use the code above, it'll only redraw
once:
- modelChanged fired for setting the
dataProvider
- modelChanged fired for adding "cow" to
it
- modelChagned fired for adding"moo" to
it
Since I use a doLater, and only 1, it'll only
redraw once per frame.
----- Original Message -----
From: superabe superabe
Sent: Saturday, January 07, 2006 11:38 AM
Subject: Re: [flexcoders] Alternative to Repeater Thanks for the help.
Couple of question
1 .What do you mean by - utilize Data Selector
on that class ?
2. In the redrawForm method what does the value "length"
represent.
If it is the length of the dataProvider, am not clear how that
was established
3. Does "modelChanged" fire every time the
dataProvider changes?
If so seems like it would redraw the entire form even if only
one item in the array changed (say using addItem).
Thanks,
- superabe
On 1/7/06, JesterXL
<[EMAIL PROTECTED]>
wrote:
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS
|

