Hi - I'm trying to sort out databinding the List component to a specific
property of objects in an ArrayCollection using Actionscript. I read
through a bunch of docs/tutorials online but either haven't found the right
one or am not understanding. Most of the examples show dataBinding using
MXML curly braces syntax.

The gist: I have a List component that I would like to bind to an
ArrayCollection, and have the List display a "name" property of each object
instance in the array. The ArrayCollection is populated with a bunch of
instances of a custom Class (code at bottom). I seem to be successful
binding it to the object instances - the List will display: [object
RP_Layer] - which is the Class name etc.

I define the ArrayCollection like this:

        [Bindable]
        public var layers:ArrayCollection = new ArrayCollection();

And assign the binding in my application mxml:

        drawingCP.layerList.dataProvider = canvasB.layers;

--drawingCP is an instance of an AS class
--layerList is a List component
--canvasB is an instance of an AS class
--layers is the ArrayCollection

When I try to bind to the "name" property of the object instance like
below, I get an error.

        drawingCP.layerList.dataProvider = canvasB.layers.name


Anyway, this may not be so clear.... ;-)  I'll keep digging around but I
thought I would ask.

--Roy



//------------- RP_Layer Class
package vo
{
      [Bindable]
          public class RP_Layer extends Object
          {
                    public var name:String;

                    public function RP_Layer(name:String)
                    {
                              this.name = name;
                    }
          }
}

-- 
-----------------------------------------------------------------
http://www.roypardi.com/



Reply via email to