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 [email protected], "thunderstumpgesatwork" <[EMAIL PROTECTED]> 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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to