I don't think you can add metadata like the bindable property at 
runtime, it has to be declared/defined in a class. Using the binding 
utils is a way to compensate for not having declared bindable 
properties. 

Personally I prefer to use VO's and bindable properties, overall a 
much cleaner solution than generic objects and the binding utils.

Derrick Grigg
-------------
www.dgrigg.com

--- In flexcoders@yahoogroups.com, "livinginswitzerland" 
<[EMAIL PROTECTED]> wrote:
>
> Derrick,
> Thanks again, and once again, you have led me to another 
question.  
> I'm aware of using the bindable metatag, and also am using the 
> binding.utils.bindProperty method to handle some other bindings I 
> need manually, but I'm now wondering if i can do the following:  
Can 
> I create an Object, and as I create properties on that Object, 
tell 
> the property to be bindable, in ActionScript.  I'm assuming the 
> metatag tells the compiler to create the necessary watchers, but 
it 
> would be really nice if that were a property I could set while I'm 
> dynamically creating properties of an Object...something like:
> 
> var myObj:Object = new Object();
> myObj.publisher = '';
> myObj.publisher.bindable=true;
> 
> Using the binding.utils.bindProperty method works great when I 
know 
> exactly the two locations between which I want to share data, but 
it 
> isn't as nice as creating a typed class within an ArrayCollection 
as 
> bindable that you can easily fit into (and broadcast changes to) a 
> datagrid.   
> 
> 
> >
> > A typed value object is basically an object that matches to some 
> data
> > entity you are working with. You create a class to define the 
> entity,
> > give it properites (that are bindable) and then put instances of 
> that
> > class into the ArrayCollection instead of non descript Objects
> > 
> > ie
> > 
> > class BookVO {
> >    [Bindable]
> >    public var title: String;
> > 
> >    [Bindable]
> >    public var author: String;
> > 
> >    [Bindable]
> >    public var ISBN: String;
> > 
> >    public function BookVO():void {
> > 
> >    }
> > }
> > 
> > ... and then loop through the results from the webservice and 
for 
> each
> > item, create a new BookVO, fill in the properties and add that 
to 
> the
> > ArrayCollection. I imagine you are probably currently doing 
> something
> > similiar to 
> > 
> > var book = new Object();
> > book.author = xmlNode.ItemAttributes.author;
> > book.title =  xmlNode.ItemAttributes.title;
> > book.ISBN =  xmlNode.ItemAttributes.ISBN;
> > 
> > This is certainly very easy to start with, but in the long run 
> causes
> > more headaches for a variety of reasons.
> > 
> > By using typed objects with bindable properties, it leverages 
the 
> Flex
> > components awareness of changes in those objects, basically the
> > components listen to the objects for changes, which means you 
don't
> > have to manually refresh things when changes happen.
> > 
> > Derrick Grigg
> > -------------
> > www.dgrigg.com
> > 
> > --- In flexcoders@yahoogroups.com, "livinginswitzerland"
> > <rickgeorge@> wrote:
> > >
> > > Thanks Derrick...
> > > 
> > > I had tried invalidateDisplay list, but not 
invalidateList..which 
> did 
> > > it.  interesting.  when you say typed value objects...can you 
> elaborate 
> > > on that?  I am doing some 'non standard' things, and all of my 
> data is 
> > > read into an ArrayCollection via a web service, but i'm not 
using 
> XML 
> > > but text instead.  Curious if what you are saying regarding 
typed 
> value 
> > > objects is something i'm bumping up against.
> > > 
> > > thanks again!
> > > 
> > > -rick
> > > 
> > > --- In flexcoders@yahoogroups.com, "Derrick Grigg" <dgrigg@> 
> wrote:
> > > >
> > > > I think you can use the 'invalidateDisplayList()'  or 
possibly 
> > > > the 'invalidateList()' to refresh your datagrid.
> > > > 
> > > > Alternatively, if you use typed value objects in the 
> dataProvider any 
> > > > changes to those, should automatically be reflected (and 
> viewed) in 
> > > > the DataGrid if you are using databinding.
> > > > 
> > > > Derrick Grigg
> > > > --------
> > > > www.dgrigg.com
> > > >
> > >
> >
>







--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to