Désolé de mon oubli....
Voici le code :
//Initialisation
champ ="" ;
casse = "maj";
adresse = "clavier.php?clav=1&enter=";
secPop = 3000;
//Fonction search and replace
String.prototype.replace = function(pFrom, pTo) {
if (arguments.length == 0) {
return this;
}
if (arguments.length == 1) {
if (pFrom instanceof Array) {
pTo = new Array(pFrom.length);
} else {
return this.split(pFrom).join("");
}
}
if (!(pFrom instanceof Array)) {
return this.split(pFrom).join(pTo);
}
var lLength = pFrom.length;
var lString = this;
if (pTo instanceof Array) {
for (var i = 0; i < lLength; i++) {
lString = lString.split(pFrom[i]).join(pTo[i]);
}
} else {
for (var i = 0; i < lLength; i++) {
lString = lString.split(pFrom[i]).join(pTo);
}
}
return lString;
};
//Chiffres
var numerique = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
var numeriqueMiniscule = new Array("0","1","2","3","4","5","6","7","8","9")
var numeriqueEnLettre = new Array("zero", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf");
//Alphabet
var alphabet = "azertyuiopqsdfghjklmwxcvbn";
var listeAlphabet = new Array();
var listeAlphabet2 = new Array("é","@","/","'","-","è","_","ç","à","ê",":",".","!");
var listeClipAlphabet2 = new Array("cs1","","","","","","","","");
listeAlphabet = alphabet.split("");
//Caractère spéciaux
var charSpecio = "¨^?:.";
var charSpecioMiniscule = "¨^!:.";
var listeCharSpecio = charSpecio.split("");
var listeCharSpecioMini = charSpecioMiniscule.split("");
var nomClipCharSpecio = new Array("trema","accent","interro","virgule","point");
//Fonction qui remplace les accents suivi de voyelles en
//en vraie lettre accentuée
var listeAccents = new Array("`a","`e","`i","`u","`o","^a","^e","^i","^u","^o","¨a","¨e","¨i","¨u","¨o","¨A","¨E","¨I","¨U","¨O","^A","^E","^I","^U","^O");
var listeCharAccents = new Array("à","è","ì","ù","ò","â","ê","î","û","ô","ä","ë","ï","ü","ö","Ä","Ë","Ï","Ü","Ö","Â","Ê","Î","Û","Ô");
var seulementAccents = new Array("¨","^","`");
var replaceCharSpeciaux = function(mot){
for(count = 0; count < listeAccents.length; count++){
mot = mot.replace(listeAccents[count],listeCharAccents[count]);
}
return mot;
}
//Fonction qui met les libellés en miniscule ou en majuscle
var setCase = function (casse) {
///Mis à jour miniscule avec accent du 02-10-06
for (count = 0; count < listeAlphabet2.length; count++) {
this["cs" + (count + 1)].libelle = listeAlphabet2[count];
this["cs" + (count + 1)].onPress = function(){
_root.champ += this.libelle;
_root.champ = _root.replaceCharSpeciaux(champ);//Gestion accents
}
}
//Assigner les libellés et les actions pour les lettres.
for (count = 0; count < listeAlphabet.length; count++) {
for (btn in this) {
if (this[btn]._name == listeAlphabet[count]) {
this[btn].libelle = casse == "maj" ? listeAlphabet[count].toUpperCase() : listeAlphabet[count];
break;
}
}
}
//Assigner les libellés et les actions pour les chiffres
for (count = 0; count < numerique.length; count++) {
this[numeriqueEnLettre[count]].libelle = casse == "maj" ? numerique[count] : numeriqueMiniscule[count];
this[numeriqueEnLettre[count]].onPress = function() {
_root.champ += this.libelle;
_root.champ = _root.replaceCharSpeciaux(champ);//Gestion accents
};
}
//Assigner les libellés pour les chars spéciaux
for(count = 0; count < nomClipCharSpecio.length; count++){
for (clip in this) {
if (this[clip]._name == nomClipCharSpecio[count]) {
this[clip].libelle = casse == "maj" ? listeCharSpecio[count] : listeCharSpecioMini[count];
break;
}
}
}
};
//Remplir les lettres
setCase(casse);
//les actions sur l'alphabet
for (count = 0; count < listeAlphabet.length; count++) {
for (clip in this) {
if (this[clip]._name == listeAlphabet[count]) {
this[clip].onPress = function(){
_root.champ += this.libelle;
_root.champ = _root.replaceCharSpeciaux(champ);//Gestion accents
}
break;
}
}
}
//Assigner les actions sur les touches des chars spéciaux
for(count = 0; count < nomClipCharSpecio.length; count++){
for (clip in this) {
if (this[clip]._name == nomClipCharSpecio[count]) {
this[clip].onPress = function(){
_root.champ += this.libelle;
_root.champ = _root.replaceCharSpeciaux(champ);//Gestion accents
}
break;
}
}
}
//Action sur la touche MAJ
caps.onPress = function(){
casse_tmp = casse == "maj" ? "min" : "maj";
casse = casse_tmp;
setCase(casse);
}
//Action sur la touche ESPACE
space.onPress = function(){
_root.champ += " ";
}
//Action sur SUPPR
suppr.onPress = function(){
_root.champ = _root.champ.slice(0, champ.length-1);
}
//Action sur la touche de validation
valider.onPress = function(){
//Enleve les accents inutilisés
for(count = 0; count < seulementAccents.length; count++){
champ = champ.replace(seulementAccents[count],"");
}//*/
if(champ.length > 0){
postIt.postchamp(champ);
msg.gotoAndStop("searchEnCours");
}else{
msg.gotoAndStop("carMin");
}
}