flash on 2009-8-13
♥0 |
Line 21 |
Modified 2009-08-13 10:22:59 |
MIT License
archived:2017-03-10 05:52:26
ActionScript3 source code
/**
* Copyright matsu ( http://wonderfl.net/user/matsu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5ooW
*/
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
private var tempStr:String;
private function bTextInputChange():void
{
var byteArray:ByteArray = new ByteArray();
byteArray.writeMultiByte(bTextInput.text, "shift_jis");
var bTextInputLength:int = byteArray.length;
if ( bTextInputLength > 20 ) {
bTextInput.text = tempStr;
} else {
tempStr = bTextInput.text;
}
}
]]>
</mx:Script>
<mx:Text text="入力制限チェック"/>
<mx:TextInput id="bTextInput" styleName="bTextInput" width="200" height="21" change="bTextInputChange();" enter="bTextInputChange();"/>
</mx:Application>