Re: [flexcoders] Property values based on Multiple Conditions
Rick is correct. You can also use a local binding function like this: where enableButton is a function in your Script block that takes two boolean parameters. Or, if you have a presentation model, it could have a computed property buttonEnabled Excerpt of presentation model: [Bindable(event="showMeChanged")] [Bindable(event="hideMeChanged")] public function get buttonEnabled():Boolean { return showMe && hideMe; } public function set showMe(value:Boolean):void { if (value != this.showMe) { this.showMe = value; dispatchEvent(new Event("showMeChanged")); } } Hope this helps. On Mon, Apr 12, 2010 at 4:31 PM, Rick Genter wrote: > > > > On Apr 12, 2010, at 10:31 AM, Doug wrote: > > > I seem to have little success with this and would like to know other ways > of accomplishing what I want to do. > > > > I'm trying to enable/disable a button based on two pieces of criteria. It > would seem that a logical OR or a logical AND would bridge these much like > an IF statement, however, I'm struggling to make it work 100%. > > > > Consider a button: > > > > > > > > This button's enabled property is based upon the binding of the variables > for "showMe" and "hideMe". If showMe or hideMe is true then the button is > enabled. This works fine when using a logical OR. However, the following - > using a logical AND - does not: > > > > > > > > How do you do a logical AND?? Also, if I wanted to set showMe and hideMe > based on several lines of code how would I best do it? How would you bind a > function output to a display object? I only see a way to do it based upon > event: > > > > [Bind (event: ] > > private function myFunction():void{} > > > > Thanks in advance!! > > I haven't tried this, but I suspect that you are being bitten by XML. Try > this: > > > > -- > Rick Genter > rick.gen...@gmail.com > > >
Re: [flexcoders] Property values based on Multiple Conditions
On Apr 12, 2010, at 10:31 AM, Doug wrote: > I seem to have little success with this and would like to know other ways of > accomplishing what I want to do. > > I'm trying to enable/disable a button based on two pieces of criteria. It > would seem that a logical OR or a logical AND would bridge these much like an > IF statement, however, I'm struggling to make it work 100%. > > Consider a button: > > > > This button's enabled property is based upon the binding of the variables for > "showMe" and "hideMe". If showMe or hideMe is true then the button is > enabled. This works fine when using a logical OR. However, the following - > using a logical AND - does not: > > > > How do you do a logical AND?? Also, if I wanted to set showMe and hideMe > based on several lines of code how would I best do it? How would you bind a > function output to a display object? I only see a way to do it based upon > event: > > [Bind (event: ] > private function myFunction():void{} > > Thanks in advance!! I haven't tried this, but I suspect that you are being bitten by XML. Try this: -- Rick Genter rick.gen...@gmail.com
[flexcoders] Property values based on Multiple Conditions
I seem to have little success with this and would like to know other ways of accomplishing what I want to do. I'm trying to enable/disable a button based on two pieces of criteria. It would seem that a logical OR or a logical AND would bridge these much like an IF statement, however, I'm struggling to make it work 100%. Consider a button: This button's enabled property is based upon the binding of the variables for "showMe" and "hideMe". If showMe or hideMe is true then the button is enabled. This works fine when using a logical OR. However, the following - using a logical AND - does not: How do you do a logical AND?? Also, if I wanted to set showMe and hideMe based on several lines of code how would I best do it? How would you bind a function output to a display object? I only see a way to do it based upon event: [Bind (event: ] private function myFunction():void{} Thanks in advance!!