Hi.. I was asking about how to do it through ActionScript... I have done it and know it works in mxml. I'm talking about adding a property binding using just actionscript, and some incantation of a
mx.binding.utils.ChangeWatcher or mx.binding.utils.BindingUtils Thunder --- In flexcoders@yahoogroups.com, "gsamsa" <[EMAIL PROTECTED]> wrote: > > > This should work pretty much just the way your example works, so maybe > one of your parameters isn't bindable? > > The following example works, and also illustrates another less elegant > way of accomplishing the same thing > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute"> > <mx:Button label="{formatLabel(prodName1.text,prodPart1.text)}" > x="10" y="40"/> > <mx:TextInput id="prodName1" y="10" x="10"/> > <mx:TextInput id="prodPart1" x="193" y="10"/> > > <mx:Button label="{formatLabel2}" x="10" y="128"/> > <mx:TextInput id="prodName2" change="dispatchEvent(new > Event('labelChanged'))" x="10" y="98"/> > <mx:TextInput id="prodPart2" change="dispatchEvent(new > Event('labelChanged'))" x="193" y="98"/> > > <mx:Script> > <![CDATA[ > private function formatLabel(x:String, y:String) : String > { > return (x + ":" + y); > } > > [Bindable("labelChanged")] > private function get formatLabel2() : String > { > return (prodName2.text + ":" + prodPart2.text); > } > ]]> > </mx:Script> > > </mx:Application> > > --- In flexcoders@yahoogroups.com, "thunderstumpgesatwork" > <thunder.stumpges@> wrote: > > > > > > Hi guys, > > > > I know in mxml you can do data binding like this: > > > > <mx:Button label="{formatLabel(someBindableTextField)}" /> > > > > where any time the bindable property "someBindableTextField" changes, > > the binding fires, and the label is replaced with the result of the > > function. > > > > This is even more powerful if the function parameters has two bindable > > properties. When either one changes, the function executes, and the > > label is updated. > > > > How can this be achieved in ActionScript? > > > > I have used the ChangeWatcher, and the BindingUtils classes but don't > > see a simple solution. > > > > thanks for any ideas =) > > Thunder > > > -- 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/