Hi Ralf ! Im fine thank you! ( I will mail you personally at gmail ) Thanks for your help. I finally got that binding working! Paul sent me some stuff (same stuff posted in flexcoders I think) and "with some time" I managed to make it work.
In summary, I was creating the binding in the wrong place. I was creating the binding in the class constructor and creating it in the "createChildren" protected method made the trick, and the binding was not a binding to a display object! :/ It was a binding from an object in the model to a setter function in the class. Anyway, thanks to everyone and specially thanks to Ralf and Paul in the EMEA Adobe Consulting team. Cheers, Alberto Ralf Bokelberg escribió: > PS. It only works, when i use the other binding instead > > > On 7/21/06, Ralf Bokelberg <[EMAIL PROTECTED]> wrote: > >> Hi Alberto, >> >> how are you doing? >> I'm not sure, why it works in the first place. I can't get it to run >> it with the following code. >> What is different in your code? >> >> -------------------- snip -------------------- >> <?xml version="1.0" encoding="utf-8"?> >> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> >> >> <mx:Script> >> <![CDATA[ >> [Bindable] >> private var mypodId : int = 0; >> >> private function set handleDestroy( destroy:* ): >> void { >> trace("handleDestroy " + destroy); >> } >> >> [Bindable] >> private var model : Model = Model.getInstance(); >> >> [Bindable] >> private var currentPod : Pod = >> model.podManager.getPod( mypodId ); >> ]]> >> </mx:Script> >> >> <!--mx:Binding >> source="currentPod.destroy" >> destination="handleDestroy" /--> >> >> <mx:Binding >> source="model.podManager.getPod( mypodId ).destroy" >> destination="handleDestroy" /> >> >> <mx:Button click="model.podManager.getPod( mypodId ).destroy = true" >> /> >> >> </mx:Application> >> >> -------------------- snip -------------------- >> package >> { >> public class Model >> { >> >> [Bindable] >> public var podManager : PodManager; >> >> public function Model() >> { >> podManager = new PodManager(); >> } >> >> private static var instance : Model; >> >> public static function getInstance() : Model >> { >> if( instance == null ) instance = new Model(); >> return instance; >> } >> } >> } >> -------------------- snip -------------------- >> package >> { >> import mx.collections.ArrayCollection; >> import flash.events.Event; >> import flash.events.EventDispatcher; >> >> public class PodManager extends EventDispatcher >> { >> >> private var pods : ArrayCollection; >> >> public function PodManager() >> { >> pods = new ArrayCollection(); >> pods.addItem( new Pod("pod0")); >> pods.addItem( new Pod("pod1")); >> pods.addItem( new Pod("pod2")); >> pods.addItem( new Pod("pod3")); >> } >> >> public function getPod( podId : int ) : Pod >> { >> return pods.getItemAt( podId ) as Pod; >> } >> } >> } >> -------------------- snip -------------------- >> package >> { >> public class Pod >> { >> >> public var name : String; >> >> [Bindable] >> public var destroy : Boolean; >> >> public function Pod( name : String ) >> { >> this.name = name; >> } >> } >> } >> -------------------- snip -------------------- >> >> Cheers, >> Ralf >> >> >> On 7/18/06, Alberto Albericio <[EMAIL PROTECTED]> wrote: >> >>> 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 >>> >>> >>> >>> >>> >>> >>> >>> >> -- >> Ralf Bokelberg <[EMAIL PROTECTED]> >> Flex & Flash Consultant based in Cologne/Germany >> >> > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Check out the new improvements in Yahoo! Groups email. http://us.click.yahoo.com/6pRQfA/fOaOAA/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/

