[flexcoders] TextEvent.TEXT_INPUT preventDefault not working on Linux

2009-01-16 Thread shawnsvacha
Has anyone run into this before?  On Linux the preventDefault event for a 
TextEvent.TEXT_INPUT event does not hide the characters entered. This works 
fine on OSX 
and Windows, but not Linux.  Here is example code:

?xml version=1.0 encoding=utf-8?
mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml; 
layout=absolute xmlns:ns1=*
ns1:CustomTextField x=10 y=10 width=500 height=22/
/mx:WindowedApplication


package
{
import flash.events.TextEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;

import mx.core.UIComponent;

public class CustomTextField extends UIComponent
{
public function CustomTextField()
{
var _customTF:TextField = new TextField();
_customTF.x = 0;
_customTF.y = 0;
_customTF.width = 480;
_customTF.height = 22;
_customTF.type = TextFieldType.INPUT;
_customTF.multiline = true;
_customTF.autoSize = TextFieldAutoSize.LEFT;
_customTF.wordWrap = true;
_customTF.maxChars = 1024;
addChild(_customTF);

_customTF.addEventListener(TextEvent.TEXT_INPUT, 
dontShowTextInput);

}

private function dontShowTextInput(e:TextEvent):void
{
e.preventDefault();
}
}
}



RE: [flexcoders] TextEvent.TEXT_INPUT preventDefault not working on Linux

2009-01-16 Thread Thomas, Erik
Is the purpose of your control to filter characters entered and disallow
some? If so, just use the restrict property:

mx:TextInput restrict=-.0123456789/
 
And you're done.
 
Just a thought because you're not clear about what you want to
accomplish. While your discovery could definitely be a bug to report to
Adobe--and you should report it anyway--it seems like your custom
control doesn't include any new behavior you won't get by configuring an
out-of-the-box TextInput control.
 
Cheers,
 
Erik



From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of shawnsvacha
Sent: Friday, January 16, 2009 9:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] TextEvent.TEXT_INPUT preventDefault not working on
Linux



Has anyone run into this before? On Linux the preventDefault event for a

TextEvent.TEXT_INPUT event does not hide the characters entered. This
works fine on OSX 
and Windows, but not Linux. Here is example code:

?xml version=1.0 encoding=utf-8?
mx:WindowedApplication xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml  
layout=absolute xmlns:ns1=*
ns1:CustomTextField x=10 y=10 width=500 height=22/
/mx:WindowedApplication

package
{
import flash.events.TextEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;

import mx.core.UIComponent;

public class CustomTextField extends UIComponent
{
public function CustomTextField()
{
var _customTF:TextField = new TextField();
_customTF.x = 0;
_customTF.y = 0;
_customTF.width = 480;
_customTF.height = 22;
_customTF.type = TextFieldType.INPUT;
_customTF.multiline = true;
_customTF.autoSize = TextFieldAutoSize.LEFT;
_customTF.wordWrap = true;
_customTF.maxChars = 1024;
addChild(_customTF);

_customTF.addEventListener(TextEvent.TEXT_INPUT, dontShowTextInput);

}

private function dontShowTextInput(e:TextEvent):void
{
e.preventDefault();
}
}
}