enabled is not a method, its a getter/setter property.

so you have to do ti.enabled = false;


--- In flexcoders@yahoogroups.com, "pdenys" <[EMAIL PROTECTED]> wrote:
>
> I am accessing a TextInput object by invoking 
myPanel.getChildByName
> ("myTextInput"); Then I try to disable the TextInput and get an 
> error. 
> 
> Why oh why? The TextInput.enabled property is public, I believe.
> 
> Thanks for your help,
> Paul
> 
> Code follows:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
> layout="absolute">
> <mx:Script>
>   <![CDATA[
>   public function shouldWork(event:Event):void 
>   {   
>     var ti:TextInput = 
>     (TextInput)(myPanel.getChildByName("myTextInput"));
>     var t:DisplayObject=myPanel.getChildByName("myTextInput");
> 
>     // The following gives error 1195:
>     // Attempted access of inaccessible method enabled through a 
>     // reference with static type mx.controls.TextInput
>     ti.enabled(false);  // Error 1195 here
>     ti.setStyle("backgroundColor", "0xFF0000"); // no compile error
>   }
>   ]]>
> </mx:Script>
> 
> <mx:Panel x="10" y="10" width="250" height="200" layout="absolute" 
> id="myPanel">
> <mx:TextInput x="10" y="10" id="myTextInput" name="myTextInput"/>
> </mx:Panel>
> </mx:Application>
>


Reply via email to