[flexcoders] Re: Binding property of object in dataProvider

2009-03-02 Thread gwangdesign
Hi Garth,

Thanks very much for the lead. I am currently following the
anonymous object advice but would like to investigate more
ObjectProxy approach later once I have more time.

Just another quick question. It seems both approaches entail
serializing objects in Flash Player at client side. Which one would be
better performance wise if I will be dealing with a large collection
of data (say 600-1000 per page)?

Best regards,

geng

--- In flexcoders@yahoogroups.com, Garth Somerville therealga...@...
wrote:

 If the point of your question is that you are starting with
anonymous objects, then wrapping each item with a mx.utils.ObjectProxy
will do what you want by making each property of the proxied object
bindable.
 
 The other alternative is not to use an anonymous object, but to
create a concrete class for the tasks:
 
 class Task {
   [Bindable]  public var label:String;
 }
 
 Ultimately this way is better for several reasons. (Note that as
shown the mxml compiler will have to rewrite the class to implement
IEventDispatcher)





[flexcoders] Re: Binding property of object in dataProvider

2009-03-01 Thread Amy
--- In flexcoders@yahoogroups.com, gwangdesign gwangdes...@... 
wrote:

 I am trying to bind a property (label) in my data object so that 
the
 changes on it can be propagated to all the views (The controls may
 want to edit this property). Currently I am wrapping them as plain
 objects in ArrayCollection and I got the following warning:
 
 warning: unable to bind to property 'label' on class 'Object' 
(class
 is not an IEventDispatcher)
 
 Does the compiler suggest making the Object a subclass of
 IEventDispatcher? How do I do it if so?
 
 My code is as below. Thanks!
 
 mx:ArrayCollection id=taskList
   mx:Object label=Word/
   mx:Object label=Media Player/
   mx:Object label=Contacts/
   mx:Object label=Apache Server/
   mx:Object label=Dictionary/
   mx:Object label=iTunes/
   mx:Object label=Solitaire/
   mx:Object label=Minesweeper/
   mx:Object label=Safari/
   mx:Object label=RSS Reader/
   /mx:ArrayCollection
   mx:VBox
   mx:Repeater id=myRP dataProvider={taskList} 
recycleChildren=true
   mx:Button horizontalCenter=0
 label={String(myRP.currentItem.label)}
 click=button_ClickHandler(event);/
   /mx:Repeater
   /mx:VBox

IEventDispatcher is not a Class, but an Interface. Maybe this will 
help:
http://flexdiary.blogspot.com/2008/11/implementing-
ieventdispatcher.html