Hi Alberto,

>From what I can tell, it seems you use bindSetter to bind to an ordinary
function. If you want to bind to a 'set' function you actually need to
use bindProperty (because 'set' functions are treated as properties).
See the demo app I have pasted below that shows both approaches.

Paul

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
        xmlns:mx="http://www.adobe.com/2006/mxml"; 
        layout="vertical"
        creationComplete="handleCreationComplete()">
        
        <mx:Label text="Input: "/>
        <mx:TextInput id="textInput"/>
        
        <mx:Label text="Bound To Property: "/>
        <mx:Label id="propertyOutput"/>
        
        <mx:Label text="Bound To Function: "/>
        <mx:Label id="setterOutput"/>
        
        <mx:Script>
                <![CDATA[
                        
                        import mx.binding.utils.*;              
                        
                        public function set myTextSetter( text : String
) : void
                        {
                                propertyOutput.text = text;
                        }                               
                        
                        public function myText( text : String ) : void
                        {
                                setterOutput.text = text;
                        }                               
                        
                        public function handleCreationComplete() : void
                        {
                                BindingUtils.bindProperty( this,
"myTextSetter", textInput, "text", false );             
                                
                                BindingUtils.bindSetter( myText,
textInput, "text", false );             
                        }
                        
                ]]>
        </mx:Script>
        
</mx:Application>

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alberto Albericio
Sent: Tuesday, July 18, 2006 10:20 PM
To: [email protected]
Subject: [flexcoders] Binding from Actionscript

Hello all,

I have an MXML component that has an mxml binding to a setter function 
like this:

<mx:Binding source="model.podManager.getPod( mypodId ).destroy" 
destination="handleDestroy" />

and a setter function defined :

private function set handleDestroy( destroy:Boolean ): void {
          // some code         
}

This works 100% but I need to create this binding in an actionscript 
component; I have tried the following:

BindingUtils.bindSetter( handleDestroy, model.podManager.getPod( 
this.mypodId ), "destroy", false );

and having the same setter function. It complains about the setter 
function. If I remove the "set" keyword (on the setter function) it 
compiles but does nothing ( the binding doesnt seem to enter the
function )

How can I create this binding from actionscript? Can someone give a 
working example on how to create a binding to a setter function in 
actionscript? It should be easy but I have found no documentation at all

on this. I need the help of an expert.

Thank you very much.

Alberto





--
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



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/

<*> 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/
 



Reply via email to