I think you’re going to need to do it later than creationComplete.  Basically in your resultHandler function you’re going to need to go through all your controls and call controlbehavior, I’m guessing that the RemoteObject result is coming after the control has been created.

 

Function resultHandler(result)

{

  iniVal = result;

  controlBehavior(textID, iniVal.ISOLATIONTOITURESTATUS);

//etc

}

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Ghislain Simard
Sent: Thursday, July 21, 2005 7:59 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to get dynamically visible or enabled a control

 

I have a function which as a role of getting dynamically visible or
not a control.  The decision of that behavior is coming from a value
sent by RemoteObject....But it doesn't want to do what I am looking
for.  Any help would be appreciated.

Thanks

CODE:
As I will have to get a behavior in a form for each controls, I need
to get a CreationComplete function on each of these controls.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
initialize="toitureObject.affichage.send()">

<mx:RemoteObject id="toitureObject"
endpoint="http://132.156.178.59/flashservices/gateway"
source="EEwizard3.G.toit_nf">

<mx:method name="affichage" result="resultHandler(event.result)">
  <mx:arguments>
   <zoneID>1</zoneID>
  </mx:arguments>
</mx:method>

</mx:RemoteObject>

<mx:Script>
<![CDATA[
  var iniVal:Object;
  function resultHandler(result){
   iniVal = result;
  }

  function controlBehavior(target:Object,x:String):Void{
   switch (Number(x)){
   case 0:
    target.visible = true;
    target.enabled = true;
    break;
   case 1:
    target.visible = true;
    target.enabled = false;
    break;
   case 2:
    target.visible = false;
    break;
   }
  
  }
]]>
 
</mx:Script>

<mx:TextInput id="textID" text="{iniVal.ISOLATIONTOITURESTATUS}"
creationComplete="controlBehavior
(textID,iniVal.ISOLATIONTOITURESTATUS)"/>
</mx:Application>

 





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