1 Reply Latest reply: Jan 9, 2013 5:58 AM by jfb00 RSS

    Add new porperty to extended text input component

    jfb00 Community Member

      Hi All,

      I have this text input component:

      http://forums.adobe.com/message/3798449

       

      I wan to restrict the negative symbol. I try adding a new property as:

       

                private var _allowNegative:Boolean = true;             public function set allowNegative(value:Boolean):void             {                 _allowNegative = value;                 if (_allowNegative)                     super.restrict = "0-9\.\\-";                 else                     super.restrict = "0-9\.";             }

       

      I am getting an error:

      Error #1056: Cannot create property allowNegative on com.NumberInput.

       

      Any ideas?

      Thanks

        • 1. Re: Add new porperty to extended text input component
          jfb00 Community Member

          The issue is using Boolean.

          I try using string as var type and it works:

           

                    private var _allowNegative:String = "yes";

                     

                      public function set allowNegative(value:String):void

                      {

                          _allowNegative = value;

                         

                          if (_allowNegative == "yes")

                              super.restrict = "0-9\.\\-";

                          else

                              super.restrict = "0-9\.";

                      }

           

          why?