Copy link to clipboard
Copied
Hi guys,
I do not know what happens. My input fields do not work and I have no syntax error. I cannot enter data.
This is my code and below my .swf
tks in advance.
package {
import flash.display.*;
import flash.text.*;
import flash.events.MouseEvent;
public class U1A7_Fidelisation extends MovieClip {
var affichage: String="";
//Déclarer la création du tableau adherents et les varialbes à être utilisés.
var rang1:Array = [];
var adherent:Array = [rang1];
public function U1A7_Fidelisation()
{
btnAjouter.addEventListener(MouseEvent.CLICK, ajouter);
btnAfficher.addEventListener(MouseEvent.CLICK, afficher);
btnSupprimer.addEventListener(MouseEvent.CLICK, supprimer);
btnMillesTotale.addEventListener(MouseEvent.CLICK, millesTotale);
//Inclure le fichier externe qui contient la fonction pour caluler les milles accumulés et
//les milles en prime.
include "U1A7_Milles.as"
}
//fonction pour ajouter les renseigments inscrits par l'utilisateur au tableau.
function ajouter(event:MouseEvent):void
{
var nom:String;
var prenom:String;
var semaineUne:int;
var semaineDeux:int;
var semaineTrois:int;
var semaineQuatre:int;
//Extraire les informations nécessaires des champs de saisie.
prenom = txtPrenom.text;
nom = txtNom.text;
semaineUne = int(semaine1.text);
semaineDeux = int(semaine2.text);
semaineTrois = int(semaine3.text);
semaineQuatre = int(semaine4.text);
adherent.push([prenom, nom, semaineUne, semaineDeux, semaineTrois, semaineQuatre]);
}
//fonction pour supprimer les renseigments du tableau.
function supprimer(event:MouseEvent):void
{
var indiceP:int=-1;
var indiceN:int=-1;
for (var rang:int = 0; rang < adherent.length; rang++)
{
indiceP =(adherent[rang][0].indexOf(txtPrenom.text));
indiceN =(adherent[rang][1].indexOf(txtNom.text));
if ((indiceP != -1) && (indiceN != -1)) // prénom et nom ont été repérés.
{
adherent.splice(rang,1); // rang - indique la rangée à supprimer.
// 1 - indique de supprimer cette rangée seulement.
}
}
}
//fonction pour afficher afin que tout les renseignements inscrits dans le tableau
//deviennent visibles.
function afficher (event:MouseEvent):void
{
affichage=("");
for (var rang:int = 0; rang < adherent.length; rang++)
{
for (var col:int = 0; col < adherent[0].length; col++)
{
affichage = affichage + " " + adherent[rang][col];
}
affichage = affichage + "\n";
}
monMessage.text = affichage;
txtPrenom.text = "";
txtNom.text = "";
semaine1.text = "";
semaine2.text = "";
semaine3.text = "";
semaine4.text = "";
}
//fonction pour calculer le total de points(milles) accumulés en 4 semaines d'un client
//et pour voir si ils obtiendront des milles en prime.
function millesTotale(event:MouseEvent):void
{
var prenom2:String;
var nom2:String;
var semaineUne2:int;
var semaineDeux2:int;
var semaineTrois2:int;
var semaineQuatre2:int;
var somme:int;
var sommeMessage:String;
affichage = "";
prenom2 = txtPrenom.text;
nom2 = txtNom.text;
semaineUne2 = int(semaine1.text);
semaineDeux2 = int(semaine2.text);
semaineTrois2 = int(semaine3.text);
semaineQuatre2 = int(semaine4.text);
somme = (semaineUne2 + semaineDeux2 + semaineTrois2 + semaineQuatre2);
if (somme >= 5000)
{
sommeMessage ="1000";
}
else if (somme < 5000)
{
sommeMessage ="0";
}
affichage = (prenom2 + nom2 + " a accumulé " + somme + " milles. Elle/Il a obtenu " + sommeMessage + " mille(s) en prime.");
//Afficher le message dans le champ de saisie monMessage.
monMessage.text = affichage;
txtPrenom.text = "";
txtNom.text = "";
semaine1.text = "";
semaine2.text = "";
semaine3.text = "";
semaine4.text = "";
}
}
Unfortunately I can't translate your code into English to better understand it, but I see you are resetting the various textfields in mutliple functions, so I would first suspect that your code is resetting them anytime you try to use them.
Copy link to clipboard
Copied
Unfortunately I can't translate your code into English to better understand it, but I see you are resetting the various textfields in mutliple functions, so I would first suspect that your code is resetting them anytime you try to use them.
Copy link to clipboard
Copied
double check (in the properties panel) that those are input textfields.
if they are and are not selectable, you have something overlying them.
Copy link to clipboard
Copied
ok, i'm looking at it.
but everything is ok in the properties.
Tks.
Copy link to clipboard
Copied
can you see your cursor when you click on an input textfield?
if no, there's something overlying it. if yes, what happens when you type a letter and number?
p.s. make sure the font color is NOT white, and you should embed your font.
p.p.s. i just saw you marked ned's response 'correct'. i don't see any change listeners where that could occur. you have click listeners but those wouldn't change any textfields unless something is clicked.
Copy link to clipboard
Copied
Hi Kglad,
in fact, i tried Ned answer but nothing happens again.
And no i can't see my cursor so i'm not able to put data in the textfield.
so for the font color, it doesn't matter, because the cursor doesn't work.
Tks
Copy link to clipboard
Copied
the font color does matter. if it's white, you won't see your cursor or anything else in the textfield.
if you don't know how to change font color (in the properties panel), you can type some characters and then 'select' them with the mouse.
Copy link to clipboard
Copied
Ho i see.
tks, i'll try this.
Tks a lot Kglad.
Copy link to clipboard
Copied
keep us updated.
Copy link to clipboard
Copied
Hi Kglad,
This is a screen print of my properties.
The font is not white.
Any help ?
Tks.
Copy link to clipboard
Copied
hi guys,
finally i found the error.
I changed the classic text to Text TLF.
And it's working now.
tks again for your help.
Copy link to clipboard
Copied
Tks Ned.
Have a great one.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now