se nessuno sa niente, se nessuno c'e' mai riuscito, se nessuno ha capito di che cavolo si tratta ...
Eccovi la soluzione
Ne derivera' anche una classe dedicata AS2.0, per ora beccatevi questa protitype con tanto di esempio, unico limite e' dato dal fatto che non essendo a tutti gli effetti un campo di input, non c'e' cursore e non c'e' controllo come se lo fosse...
... spero di non aver dimenticato tasti perche' vi assicuro che non m'e' passato un attimo ...
N.B. il CAPSLOCK non l' ho ancora implementato ...
codice:
_global.ASCIIconverter = new Object();
ASCIIconverter["65"] = "a";
ASCIIconverter["66"] = "b";
ASCIIconverter["67"] = "c";
ASCIIconverter["68"] = "d";
ASCIIconverter["69"] = "e";
ASCIIconverter["70"] = "f";
ASCIIconverter["71"] = "g";
ASCIIconverter["72"] = "h";
ASCIIconverter["73"] = "i";
ASCIIconverter["74"] = "j";
ASCIIconverter["75"] = "k";
ASCIIconverter["76"] = "l";
ASCIIconverter["77"] = "m";
ASCIIconverter["78"] = "n";
ASCIIconverter["79"] = "o";
ASCIIconverter["80"] = "p";
ASCIIconverter["81"] = "q";
ASCIIconverter["82"] = "r";
ASCIIconverter["83"] = "s";
ASCIIconverter["84"] = "t";
ASCIIconverter["85"] = "u";
ASCIIconverter["86"] = "v";
ASCIIconverter["87"] = "w";
ASCIIconverter["88"] = "x";
ASCIIconverter["89"] = "y";
ASCIIconverter["90"] = "z";
ASCIIconverter["100"] = "4";
ASCIIconverter["101"] = "5";
ASCIIconverter["102"] = "6";
ASCIIconverter["103"] = "7";
ASCIIconverter["104"] = "8";
ASCIIconverter["105"] = "9";
ASCIIconverter["106"] = "*";
ASCIIconverter["107"] = "+";
ASCIIconverter["109"] = "-";
ASCIIconverter["110"] = ".";
ASCIIconverter["111"] = "/";
ASCIIconverter["32"] = " ";
ASCIIconverter["186"] = "è";
ASCIIconverter["187"] = "+";
ASCIIconverter["188"] = ",";
ASCIIconverter["189"] = "-";
ASCIIconverter["190"] = ".";
ASCIIconverter["192"] = "ò";
ASCIIconverter["193"] = "à";
ASCIIconverter["194"] = "ù";
ASCIIconverter["219"] = "'";
ASCIIconverter["220"] = "\\";
ASCIIconverter["221"] = "ì";
ASCIIconverter["48"] = "0";
ASCIIconverter["49"] = "1";
ASCIIconverter["50"] = "2";
ASCIIconverter["51"] = "3";
ASCIIconverter["52"] = "4";
ASCIIconverter["53"] = "5";
ASCIIconverter["54"] = "6";
ASCIIconverter["55"] = "7";
ASCIIconverter["56"] = "8";
ASCIIconverter["57"] = "9";
ASCIIconverter["96"] = "0";
ASCIIconverter["97"] = "1";
ASCIIconverter["98"] = "2";
ASCIIconverter["99"] = "3";
TextField.prototype.inputListener = function( myEmbedFont ) {
// andr3a 13/01/2004
this.myEmbedFontsInput = new Object();
this.myEmbedFontsInput.selectionPath = this;
this.myEmbedFontsInput.shiftPushed = false;
this.myEmbedFontsInput.altGrPushed = false;
this.myEmbedFontsInput.onKeyDown = function() {
if( String( Selection.getFocus() ) == String( this.selectionPath ) ) {
if( Key.getCode() == 8 && this.selectionPath.text.length > 0 ) {
var nowLength = new Number( this.selectionPath.text.length );
this.selectionPath.text = this.selectionPath.text.substring( 0, ( nowLength-1 ) );
}
else if( Key.getCode() == 188 && this.shiftPushed == true ) {
this.selectionPath.text += ";";
}
else if( Key.getCode() == 190 && this.shiftPushed == true ) {
this.selectionPath.text += ":";
}
else if( Key.getCode() == 189 && this.shiftPushed == true ) {
this.selectionPath.text += "_";
}
else if( Key.getCode() == 194 && this.shiftPushed == true ) {
this.selectionPath.text += "§";
}
else if( Key.getCode() == 193 && this.shiftPushed == true ) {
this.selectionPath.text += "°";
}
else if( Key.getCode() == 192 && this.shiftPushed == true ) {
this.selectionPath.text += "ç";
}
else if( Key.getCode() == 187 && this.altGrPushed == true ) {
this.selectionPath.text += "]";
}
else if( Key.getCode() == 187 && this.shiftPushed == true ) {
this.selectionPath.text += "*";
}
else if( Key.getCode() == 186 && this.altGrPushed == true ) {
this.selectionPath.text += "[";
}
else if( Key.getCode() == 186 && this.shiftPushed == true ) {
this.selectionPath.text += "é";
}
else if( Key.getCode() == 221 && this.shiftPushed == true ) {
this.selectionPath.text += "^";
}
else if( Key.getCode() == 220 && this.shiftPushed == true ) {
this.selectionPath.text += "|";
}
else if( Key.getCode() == 57 && this.shiftPushed == true ) {
this.selectionPath.text += ")";
}
else if( Key.getCode() == 56 && this.shiftPushed == true ) {
this.selectionPath.text += "(";
}
else if( Key.getCode() == 55 && this.shiftPushed == true ) {
this.selectionPath.text += "/";
}
else if( Key.getCode() == 54 && this.shiftPushed == true ) {
this.selectionPath.text += "&";
}
else if( Key.getCode() == 53 && this.shiftPushed == true ) {
this.selectionPath.text += "%";
}
else if( Key.getCode() == 52 && this.shiftPushed == true ) {
this.selectionPath.text += "$";
}
else if( Key.getCode() == 51 && this.shiftPushed == true ) {
this.selectionPath.text += "£";
}
else if( Key.getCode() == 50 && this.shiftPushed == true ) {
this.selectionPath.text += '"';
}
else if( Key.getCode() == 48 && this.shiftPushed == true ) {
this.selectionPath.text += "=";
}
else if( Key.getCode() == 219 && this.shiftPushed == true ) {
this.selectionPath.text += "?";
}
else if( Key.getCode() == 49 && this.shiftPushed == true ) {
this.selectionPath.text += "!";
}
else if( Key.getCode() != 8 && ASCIIconverter[Key.getCode()] != undefined ) {
var entryText = this.shiftPushed == true ? ASCIIconverter[Key.getCode()].toUpperCase() : ASCIIconverter[Key.getCode()];
this.selectionPath.text += entryText;
}
else if( Key.getCode() == 16 && this.shiftPushed == false ) {
this.shiftPushed = true;
}
else if( Key.getCode() == 18 && this.altGrPushed == false ) {
this.altGrPushed = true;
}
this.selectionPath.setTextFormat( myEmbedFont );
}
}
this.myEmbedFontsInput.onKeyUp = function() {
if( Key.getCode() == 16 ) {
this.shiftPushed = false;
}
else if( Key.getCode() == 18 ) {
this.altGrPushed = false;
}
}
Key.addListener( this.myEmbedFontsInput );
}
var myFont = new TextFormat();
myFont.font = "V1"; // linkage del font in library
this.createTextField( "myInput", 1, 10, 10, 200, 20 );
this["myInput"].border = true;
this["myInput"].borderColor = 0x000000;
this["myInput"].embedFonts = true;
this["myInput"].inputListener( myFont );
this.createTextField( "myInput2", 2, 10, 40, 200, 20 );
this["myInput2"].border = true;
this["myInput2"].borderColor = 0x000000;
this["myInput2"].embedFonts = true;
this["myInput2"].inputListener( myFont );
saluti