The official documentation says to use the following syntax: [Bindable(event="eventname")]
Jules' suggestion seems to be an alias for it (the Adobe team is also using this one): [Bindable("eventname")] Haykel Ben Jemia Allmas Web & RIA Development http://www.allmas-tn.com On Tue, Nov 25, 2008 at 10:47 AM, Jules Suggate <[EMAIL PROTECTED]>wrote: > Have you tried just doing [Bindable("dataChanged")] instead of > [Bindable(name="dataChanged")]? > > > On Tue, Nov 25, 2008 at 17:32, Michael Prescott > <[EMAIL PROTECTED] <michael.r.prescott%40gmail.com>> wrote: > > Oh sorry, I omitted the the getter from my example - but yes, I have > > getters. (The IDE warns you that [Bindable] doesn't do anything when you > > omit the getter.) > > > > I'm wondering if data binding requires the event to be a > PropertyChangeEvent > > for data binding to work? > > > > Michael > > > > On Mon, Nov 24, 2008 at 11:12 PM, Amy <[EMAIL > > PROTECTED]<amyblankenship%40bellsouth.net>> > wrote: > >> > >> --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, > "Michael Prescott" > >> > >> <[EMAIL PROTECTED]> wrote: > >> > > >> > I'm having some troubles with data binding and a named event > >> generated > >> > by a custom non-visual component. What I'm trying to do is have a > >> > property (say, 'data') which, when it changes, triggers the usual > >> > data-binding updates, but also fires an event that can be listened > >> to > >> > in the MXML. For example: > >> > > >> > <foo:MyClass id="thingy" dataChanged="Alert.show('hi mom');"/> > >> > <mx:Label text={thingy.data}"/> > >> > > >> > I can't seem to meet both of these requirements without throwing two > >> > separate events. Is this what I should expect? > >> > > >> > When I do this: > >> > > >> > [Event(name="dataChanged")] > >> > public class MyClass { > >> > > >> > [Bindable(name="dataChanged")] > >> > public function set data(data:Object):void { > >> > this._data = data; > >> > dispatchEvent( new Event("dataChanged") ); > >> > > >> > ..then the data binding doesn't work. (The label text doesn't get > >> > updated.) It seems I have to resort to vanilla data binding (with > >> no > >> > event name), and in addition throw a 'dataChanged' event of my own. > >> > > >> > [Event(name="dataChanged")] > >> > public class MyClass { > >> > > >> > [Bindable] > >> > public function set data(data:Object):void { > >> > this._data = data; > >> > dispatchEvent( new Event("dataChanged") ); > >> > > >> > Am I missing something? > >> > >> When Flex comes back to look at your data because you fired the > >> event, it can't get it because you made it write only by only > >> providing a setter and not a getter. > >> > >> HTH; > >> > >> Amy > >> > > > > > >