Probably you should pass in the text input itself into the controlBehavior function so that it can modify the proper component.

 

Function controlBehavior(comp:UIObject, x:String):Void {

  …

  Comp.visible = …

  Comp.enabled = …

}

 

creationComplete=”controlBehavior(event.target, iniVal.isoStatus)” />

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ghislain Simard
Sent: Tuesday, July 19, 2005 8:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Visible & Enabled behavior for controls & Containers

 

Hi,
I'm trying to find a way to get the fields in a form visible or
enabled based on a value received from an Object.  I'm sure I'm not
far from the solution.  But as I am not skilled in ActioScript, I
need some help to figure out this one.  I would like to get a
generic script that could be applied to any containers or controls.

Thanks

Code:
//Object returned by the RemoteObject call
var initVal:Object = result;

// function to configure the visible & enabled attributes
      function controlBehavior(x:String):Void{
            switch (x){
            case 0:
                  this.visible = false;
                  this.enabled = true;
            case 1:
                  this.visible = true;
                  this.enabled = false;
            case 2:
                  this.visible = false;
            }
      }

<mx:TextInput id="myInput" text="{iniVal.isoValue}"
creationComplete="controlBehavior(iniVal.isoStatus)"/>





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




Reply via email to