3 Replies Latest reply on Jul 13, 2011 2:28 PM by AlHolden

    Can not change restrict property of TextInput via ActionScript

    AlHolden Level 1

      Please tell me why this does not work, or suggest a workaround.


      This debug example should change the TextInput to allow a dash when the box is checked, yes?


      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">


                  public function chkClicked():void {
                      if(chk1.selected) {
                          trace('box checked, allow -');
                          ti1.restrict = "0-9.\-";
                      else {
                          trace('box unchecked, disallow -');
                          ti1.restrict = "0-9.";
              <s:CheckBox id="chk1" click="chkClicked()" />
              <s:TextInput id="ti1" width="60" restrict="0-9." />




      Each of the restrict strings will work when applied directly as a mxml attribute.