Problème pour "boutons.enabled = false"

Résolu
BBFUNK01 Messages postés 1310 Date d'inscription jeudi 16 juillet 2009 Statut Membre Dernière intervention 20 juin 2014 - 8 janv. 2010 à 20:23
piere2 Messages postés 235 Date d'inscription lundi 26 février 2007 Statut Membre Dernière intervention 26 mai 2013 - 9 janv. 2010 à 19:04
Bonsoir à toutes et à tous,

je suis en train de rédiger un code pour créer petit système de panier dans Flash et pour cela j'ai besoin à un moment que certains de mes boutons ne puissent pas être cliqués.
J'ai donc essayé plusieurs solutions, et le comble c'est qu'à un moment j'y suis parvenu, le problème c'est qu'en essayant d'avancer j'ai modifié le code et je n'arrive plus à retrouver comment j'ai réussi à rendre mes boutons non-cliquables. Je commence donc à devenir fou...

Bref, si une bonne âme lit ce post et a la solution, ça m'évitera la camisole :)

voici le code en question :
title = songInfo[songNum].title;{
this._parent.panier.commande1.text = com1;
this._parent.panier.pricom1.text = prix1;
this._parent.panier.btn_panier.onPress = function(){
prix1 = "45";
com1 = title;
trace(com1);
trace(this._parent.panier.commande1.text);
}
this._parent.panier.eff_com1.onPress = function(){
com1 = "Sélectionnez un morceau";
prix1 = "0";
this._parent.panier.lice45_1.enabled = false;
this._parent.panier.lice69_1.enabled = false;
this._parent.panier.lice79_1.enabled = false;
this._parent.panier.lice99_1.enabled = false;
}
this._parent.panier.lice45_1.onPress = function(){
prix1 = "45";
}
this._parent.panier.lice69_1.onPress = function(){
prix1 = "69";
}
this._parent.panier.lice79_1.onPress = function(){
prix1 = "79";
}
this._parent.panier.lice99_1.onPress = function(){
prix1 = "99";
}
}


Merci à toutes et tous,

BBFUNK01

6 réponses

BBFUNK01 Messages postés 1310 Date d'inscription jeudi 16 juillet 2009 Statut Membre Dernière intervention 20 juin 2014 6
8 janv. 2010 à 21:53
Du coup ça y est : j'ai trouvé la solution, et évidemment c'était tout con !

j'ai fait :
title = songInfo[songNum].title;{
this._parent.panier.commande1.text = com1;
this._parent.panier.pricom1.text = prix1;
if (prix1 == "45"){
this._parent.panier.lice45_1.enabled = true;
this._parent.panier.lice69_1.enabled = true;
this._parent.panier.lice79_1.enabled = true;
this._parent.panier.lice99_1.enabled = true;
}else if (prix1 == "0"){
this._parent.panier.lice45_1.enabled = false;
this._parent.panier.lice69_1.enabled = false;
this._parent.panier.lice79_1.enabled = false;
this._parent.panier.lice99_1.enabled = false;
}
this._parent.panier.btn_panier.onPress = function(){
prix1 = "45";
com1 = title;
trace(com1);
trace(this._parent.panier.commande1.text);
}
this._parent.panier.eff_com1.onPress = function(){
com1 = "Sélectionnez un morceau";
prix1 = "0";
}
this._parent.panier.lice45_1.onPress = function(){
prix1 = "45";
}
this._parent.panier.lice69_1.onPress = function(){
prix1 = "69";
}
this._parent.panier.lice79_1.onPress = function(){
prix1 = "79";
}
this._parent.panier.lice99_1.onPress = function(){
prix1 = "99";
}
}

Et là ça fonctionne bien.
3
BBFUNK01 Messages postés 1310 Date d'inscription jeudi 16 juillet 2009 Statut Membre Dernière intervention 20 juin 2014 6
8 janv. 2010 à 20:38
Voici un autre de mes essais :
title = songInfo[songNum].title;{
this._parent.panier.commande1.text = com1;
this._parent.panier.pricom1.text = prix1;
this._parent.panier.btn_panier.onPress = function(){
prix1 = "45";
com1 = title;
trace(com1);
trace(this._parent.panier.commande1.text);
}
this._parent.panier.eff_com1.onPress = function(){
com1 = "Sélectionnez un morceau";
prix1 = "0";
}
this._parent.panier.lice45_1.onPress = function(){
if ((com1 title) & (prix1 "45")){
prix1 = "45";
}else if ((com1 "Sélectionnez un morceau") & (prix1 "0")){
this._parent.panier.lice45_1.enabled = false;
}
}
this._parent.panier.lice69_1.onPress = function(){
if ((com1 title) & (prix1 "45")){
prix1 = "69";
}else if ((com1 "Sélectionnez un morceau") & (prix1 "0")){
this._parent.panier.lice69_1.enabled = false;
}
}
this._parent.panier.lice79_1.onPress = function(){
if ((com1 title) & (prix1 "45")){
prix1 = "79";
}else if ((com1 "Sélectionnez un morceau") & (prix1 "0")){
this._parent.panier.lice79_1.enabled = false;
}
}
this._parent.panier.lice99_1.onPress = function(){
if ((com1 title) & (prix1 "45")){
prix1 = "99";
}else if ((com1 "Sélectionnez un morceau") & (prix1 "0")){
this._parent.panier.lice99_1.enabled = false;
}
}
}


... et ce que je ne pige pas, c'est que les boutons "enabled = false"... et bien ils sont cliquables !
0
piere2 Messages postés 235 Date d'inscription lundi 26 février 2007 Statut Membre Dernière intervention 26 mai 2013
8 janv. 2010 à 22:04
Bonsoir,
Il faut bien faire attention au ciblage des objets.
Soit un clip quelconque:

th = this;//this représente le clip

//bt = un bouton dans le clip

bt.onRelease = function(){
this.enabled = false;//bloque ce bouton car this désigne le bouton
th.enabled = false;//bloque le clip contenant ce bouton
}

Je n'ai pas oscculté le reste mais regarde déjà ce point; c'est impératif...

Pi'ère2
0
BBFUNK01 Messages postés 1310 Date d'inscription jeudi 16 juillet 2009 Statut Membre Dernière intervention 20 juin 2014 6
9 janv. 2010 à 15:19
Salut Pi'ère2,

du coup j'avais trouvé la solution, et ça marche parfaitement.
A tout hasard, est-ce que tu connais un code pour additionner le contenu de plusieurs champs de texte dynamique dans un autre champ de texte dynamique ?
Du genre si j'ai 3 champs de texte "prix" comme dans mon code plus haut, quelque chose qui donnerait :

prix1 + prix2 + prix3 = total

donc si prix1 45, prix2 30, prix3 = 10, total = 85.

J'en profite pour te demander car j'arrive à cette partie dans mon code et je vais donc commencer à chercher comment faire, mais si jamais tu connais la méthode, indique moi comment procéder s.t.p.

Merci,

BBFUNK01
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
piere2 Messages postés 235 Date d'inscription lundi 26 février 2007 Statut Membre Dernière intervention 26 mai 2013
9 janv. 2010 à 15:51
une variable prix qui reçois les données numériques des champs prix;
ex this._parent.panier.lice45_1.onPress = function(){
prix1 = 45;//et non "45"
prix += nouvoprix;
}


Pi'ère2
0
piere2 Messages postés 235 Date d'inscription lundi 26 février 2007 Statut Membre Dernière intervention 26 mai 2013
9 janv. 2010 à 19:04
je corrige ma bêtise

une variable prix qui reçois les données numériques;
ex this._parent.panier.lice45_1.onPress = function(){
prix1 = 45;//et non "45"
prix += prix1;
}



Pi'ère2
0
Rejoignez-nous