Search code examples
actionscript-3apache-flexactionscriptflex4

Flex - deleting a string in text input leaves a square symbol


When I type something in a and the delete it with Ctrl + Backspace the word gets deleted but then a strange square symbol appears.

The browser I am using is Chrome.

Also I tried to ignore some keyboard keys to see if this will workaround the problem but with no success:

   function onKeyDownPressed(event:KeyboardEvent):void {
      if (event.keyCode == Keyboard.CONTROL){
         //Keyboard event ignored
         return;
      }
   }

Any ideas why do I get this square symbol and how to ignore it?


Solution

  • I overrided the expected behavior for Control+Backspace and now it seems to work. Obviously not all browsers support the Ctrl+Backspace combination.

    function onKeyDownPressed(event:KeyboardEvent):void {
       if (event.ctrlKey && event.keyCode == Keyboard.BACKSPACE){
            var deltedString:String = 
                inputTxt.text.substring(0, inputTxt.text.lastIndexOf(" "));
                inputTxt.text = deletedString;
       }
    }