TileList is a data-driven control.  And to be accurate, it does not have
a component in it, but rather has an itemRenderer property that takes a
component class value.  This is important, because itemRenderers have
rules entirely their own and are much more complicated than, say, a
component in a Tile container.

 

With data-driven components, you almost never access the individual item
controls or contents, like the stepper.  Instead, the item renderer
should update a property in the associated dataProvider item.  You then
use the dataProvider to get the value from the outside.

 

The second issue you note is related.  Itemrenderers are recycled and
only the visible ones, plus a few for buffering, even exist.  When you
scroll, or when the underlying data changes, all the visible renderers
get a new dataProvider item and refresh themselves, using the data in
the item.  If you have a control, like a stepper, that does not have its
value set from the dataProvider item, then you will get seemingly random
values in that control.

 

Custom item renderers are tricky to deal with.  Just note the huge
number of posts asking about them.   There is no shortcut to learning
about them.  Thee are many examples, at all levels available.  Google is
probably the best place to start, or go straight to the Flex docs of the
Flex cookbook, etc.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Shaun McCran
Sent: Friday, October 05, 2007 5:26 AM
To: [email protected]
Subject: RE: [flexcoders] Referencing elements in a component

 

Any thoughts on this?

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of smccran
Sent: 05 October 2007 08:25
To: [email protected]
Subject: [flexcoders] Referencing elements in a component

Hi,

I have TileList (Shopping basket), with a component in it. 

The tilelist has a numeric stepper displayed in the component. There 
is a change event on the stepper, that calls a function that 
increases or decreases the number of that item in the basket. 

I have two problems, the first is that there is also a button 
to 'remove item from basket' in the function for this I cannot get it 
to reference the numeric stepper (ns.value = ns.value -1) how do you 
reference items inside a component from external (component to 
external is 'outerDocument'). I've seen the 'target.xxx', is that 
anything to do with it.

The second is that I have many items in the TileList, sometimes if I 
active the second numeric stepper it affects the first item. How do 
you reference a specific index, or row of the tilelist?

Thanks
Shaun

 

The contents and any attachments of this electronic mail message are
confidential and intended only for the named addressee. It may contain
information covered by legal, professional or other privilege.  You are
notified that any disclosure, copying and distribution is prohibited.
If you received this email in error, please accept our apologies, and we
would appreciate that you return it to us. Europa Group Limited is
authorised and regulated by the Financial Services Authority.Registered
Office: 29 High Street, Thornbury, BS35 2FD. Registered in Wales Reg No
3279177

 

Reply via email to