|
You basically do:
- create a new abstract base class for your
component as ActionScript
- utilize DataSelector on that class
- extend that class in a new file
- have the new file do something like
this
function modelChanged()
{
cancelAllDoLaters();
doLater(this,
"redrawForm");
}
function redrawForm()
{
canvas_mc.destroyAllChildren();
var i:Number =
length;
while(i--)
{
var
item:Object = getItemAt(i);
canvas_mc.createChild(SomeComponent);
}
}
What is happening here is whenever the dataProvider
changes, the form is redrawn. It's only redrawn once per frame in case
dataProvider has 50 billion changes.
If you see the createChild call for the canvas,
basically you could put in logic, say, to create images, and then call load on
them based on the url for the current item.
Then, you can finally use that AS component as MXML
elsewhere. Make sense?
----- Original Message -----
From: superabe superabe
Sent: Saturday, January 07, 2006 11:09 AM
Subject: [flexcoders] Alternative to Repeater Is there an alternative to using a Repeater , that I could make use of in
my component (AS based).
For e.g.
Say I have a component called "Comp"
Comp.mxml (Pseudo-code)
===========
<mx:VBox>
<mx:Script>
public var dp:Array;
</mx:Script>
<mx:Repeater dataProvider="{dp}">
<mx:Image source="{currentItem.url}"/>
</mx:Repeater>
</mx:VBox>
Comp is used in Main.mxml and the dataprovider for Comp is set in
Main.mxml.
Main also may add and remove items from the the dataprovider for Comp on
subsequent events.
I would like to write Comp as an Actionscript class and avoid a Repeater
all together.
I may be missing something really obvious, but how would I do that ?
TIA,
- superabe
-- 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
|
- Re: [flexcoders] Alternative to Repeater JesterXL
- Re: [flexcoders] Alternative to Repeater superabe superabe
- Re: [flexcoders] Alternative to Repeater JesterXL
- Re: [flexcoders] Alternative to Repeater superabe superabe
- Re: [flexcoders] Alternative to Repeate... Jesse Warden
- Re: [flexcoders] Alternative to Repeater JesterXL

