Re: [flexcoders] Binding from Actionscript
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 >> >> http://www.adobe.com/2006/mxml"; layout="absolute"> >> >> >> >> >> >> >> >> > source="model.podManager.getPod( mypodId ).destroy" >> destination="handleDestroy" /> >> >> > /> >> >> >> >> 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: >>> >>> >> 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 ou
RE: [flexcoders] Binding from Actionscript
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 http://www.adobe.com/2006/mxml"; layout="vertical" creationComplete="handleCreationComplete()"> -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alberto Albericio Sent: Tuesday, July 18, 2006 10:20 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Binding from Actionscript Hello all, I have an MXML component that has an mxml binding to a setter function like this: 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/
Re: [flexcoders] Binding from Actionscript
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 > > http://www.adobe.com/2006/mxml"; layout="absolute"> > > > > > > > > source="model.podManager.getPod( mypodId ).destroy" > destination="handleDestroy" /> > > /> > > > > 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: > > > > > 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 > -- Ralf Bokelberg <[EMAIL PROTECTED]> Flex & Flash Consultant based in Cologne/Germany 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/
Re: [flexcoders] Binding from Actionscript
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 http://www.adobe.com/2006/mxml"; layout="absolute"> 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: > > 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 ~--> See what's inside the new Yahoo! Groups email. http://us.click.yahoo.com/2pRQfA/bOaOAA/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/
[flexcoders] Binding from Actionscript
Hello all, I have an MXML component that has an mxml binding to a setter function like this: 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 Yahoo! Groups Sponsor ~--> Great things are happening at Yahoo! Groups. See the new email design. http://us.click.yahoo.com/TISQkA/hOaOAA/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/