"Object" is dynamic and you can't bind to it. (I would expect binding warnings from the compiler) Create your own bindable class. Or wrap the Object in ObjectProxy, if I recall correctly.
Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Vega Sent: Sunday, July 13, 2008 3:11 PM To: [email protected] Subject: Re: [flexcoders] Re: Passing objects to components So there is no way to push the object down to my component? On Sun, Jul 13, 2008 at 2:40 PM, Michael VanDaniker <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: You've declared that the instance obj should be bindable, but that doesn't make the properties on the class Object bindable. What you can do is create a class for the object you want to pass your custom component and add the bindable metadata tag to the properties you want to bind on. You can also add the metadata tag to the class definition. That will make all of the properties of the class bindable. package { [Bindable] public class Obj extends Object { public function Obj() { super(); } public var str:String = ""; } } --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Dan Vega" <[EMAIL PROTECTED]> wrote: > > If I want to pass a string to my custom component its pretty easy. Lets say > you have a custom button component and in that component you declare a > public var str, when you create your custom button you can simply do the > following. > > <local:CustomButton str="Hello World"/> > > This works fine, but If I create an object and I want to pass an object into > the custom component it does not seem to be working. The button is displayed > but the button label is not displayed. Here is a quick example to show what > I am doing. > > > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute" > xmlns:local="*" creationComplete="init()"> > > <mx:Script> > <![CDATA[ > [Bindable] > public var obj:Object; > > private function init():void { > obj = new Object(); > obj.str="Hello Object"; > } > ]]> > </mx:Script> > > <local:Screen obj="{obj}"/> > > </mx:Application> > > > Custom Component > <?xml version="1.0" encoding="utf-8"?> > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> "> > > <mx:Script> > <![CDATA[ > [Bindable] > public var obj:Object = new Object(); > ]]> > </mx:Script> > > <mx:Button label="{obj.str}"/> > > </mx:Canvas> > > > -- > Dan >

