4 Replies Latest reply on Jun 15, 2007 9:07 AM by ntsiii

    Any alternative for eval()

    salimsdesign
      As eval() is removed from AS3, I am facing problem while using loop and making multiple TextInput invisible.

      Here is my code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      public function hideInputs():void{
      for (i=0; i<3; i++){
      ["input"+i]visible=false;
      }
      }
      ]]>
      </mx:Script>
      <mx:TextInput x="75.5" y="44" width="100" id="input0"/>
      <mx:TextInput x="183.5" y="44" width="100" id="input1"/>
      <mx:TextInput x="291.5" y="44" width="100" id="input2"/>
      <mx:Button x="75.5" y="103" label=" Hide Inputs" click="hideInputs()"/>

      </mx:Application>

      As eval() is removed, I am using this code:

      ["input"+i]visible=false;

      But this is also not working and I am getting an error message "1064 invalid metadata".
      Can anyone figure it out?

      Thanks