Accueil > Forum > > > > J'aimerai faire une fonction avec un argument ???
J'aimerai faire une fonction avec un argument ???
mardi 6 mai 2003 à 16:32:03 |
J'aimerai faire une fonction avec un argument ???

Martino26
|
Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps ex pour le zoom //code actuel sans fonction pour 2 photos on (press) { if ((compteur == 1) && (img1._height < 339)) { img1._height = img1._height * 1.5; img1._width = img1._width * 1.5; cadrephoto._height = img1._height + 40; cadrephoto._width = img1._width + 40; } if ((compteur == 2) && (img2._height < 339)) { img2._height = img2._height * 1.5; img2._width = img2._width * 1.5; cadrephoto._height = img2._height + 40; cadrephoto._width = img2._width + 40; } } Je voudrait avoir un style de fonction //code voulu pour plusieur photo a la fois :P function.zoom(valeur) { if (img + valeur + ._height < 339) { img + valeur + ._height = img + valeur + ._height * 1.5; img + valeur + ._width = img + valeur + ._width * 1.5; cadrephoto._height = img + valeur + ._height + 40; cadrephoto._width = img + valeur + ._width + 40; } } et apres faire mon action de bouton avec on (press) { valeur = compteur; zoom(valeur); } SVP si quelqu un sait si c'est possible repondez moi :)
|
|
mardi 6 mai 2003 à 18:55:24 |
Re : J'aimerai faire une fonction avec un argument ???

tombal
|
Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe
Pour une fonction : function nom_de_fonction (parametre) { //code }
Pour l'histoire du img1, img2... _root["img"+x]._height = valeur
exemple : function zoom (x,aggrandissement) { _root.["img"+x].height = _root.["img"+x].height*aggrandissement; //Tu fais praeil avec le reste }
//pour zoomer l'image 3 d'un facteur 2 zoom (3,2);
Tombal
------------------------------- Réponse au message : -------------------------------
> Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > ex pour le zoom > > > //code actuel sans fonction pour 2 photos > on (press) { > if ((compteur == 1) && (img1._height < 339)) { > img1._height = img1._height * 1.5; > img1._width = img1._width * 1.5; > cadrephoto._height = img1._height + 40; > cadrephoto._width = img1._width + 40; > } > if ((compteur == 2) && (img2._height < 339)) { > img2._height = img2._height * 1.5; > img2._width = img2._width * 1.5; > cadrephoto._height = img2._height + 40; > cadrephoto._width = img2._width + 40; > } > > } > > > Je voudrait avoir un style de fonction > > //code voulu pour plusieur photo a la fois :P > function.zoom(valeur) { > if (img + valeur + ._height < 339) { > img + valeur + ._height = img + valeur + ._height * 1.5; > img + valeur + ._width = img + valeur + ._width * 1.5; > cadrephoto._height = img + valeur + ._height + 40; > cadrephoto._width = img + valeur + ._width + 40; > } > > } > > et apres faire mon action de bouton avec > > on (press) { > valeur = compteur; > zoom(valeur); > } > > > > SVP si quelqu un sait si c'est possible repondez moi :)
|
|
mardi 6 mai 2003 à 19:55:58 |
Re : J'aimerai faire une fonction avec un argument ???

Martino26
|
Merci tu ma bien compris a ce que je voit j ai tester et je ny arrive pas. Avec l aide quej ai trouver dans le dictionnaire action script je voit bien que tu as raison Mais j ai tj des erreur quand je compile
j ai pourtant fait ma fonction comme tu me la montrer c'est peut-etre que je ne sait pas ou mettre ma fonction la c'est dans la meme séquence et dans la scene 1 la scene de mon fond de mon site function zoom(x) { _root.["img"+x].height = _root.["img"+x].height * 1.5; _root.["img"+x].width = _root.["img"+x].width * 1.5; cadrephoto._height = _root.["img"+x].height + 40; cadrephoto._width = _root.["img"+x].width + 40; }
jai ses 4 erreur la une pour chaque ligne Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. _root.["img"+x].height = _root.["img"+x].height * 1.5;
(meme erreur pour les 4 lignes)
et la fonction elle est declancher par un bouton avec on (press) { zoom(compteur); }
compteur etant le numero de l image
Je fait plein de test en attendant ta reponse :)
------------------------------- Réponse au message : -------------------------------
> Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe > > Pour une fonction : > function nom_de_fonction (parametre) { > //code > } > > Pour l'histoire du img1, img2... > _root["img"+x]._height = valeur > > > exemple : > function zoom (x,aggrandissement) { > _root.["img"+x].height = _root.["img"+x].height*aggrandissement; > //Tu fais praeil avec le reste > } > > //pour zoomer l'image 3 d'un facteur 2 > zoom (3,2); > > Tombal > > ------------------------------- > Réponse au message : > ------------------------------- > > > Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > > > ex pour le zoom > > > > > > //code actuel sans fonction pour 2 photos > > on (press) { > > if ((compteur == 1) && (img1._height < 339)) { > > img1._height = img1._height * 1.5; > > img1._width = img1._width * 1.5; > > cadrephoto._height = img1._height + 40; > > cadrephoto._width = img1._width + 40; > > } > > if ((compteur == 2) && (img2._height < 339)) { > > img2._height = img2._height * 1.5; > > img2._width = img2._width * 1.5; > > cadrephoto._height = img2._height + 40; > > cadrephoto._width = img2._width + 40; > > } > > > > } > > > > > > Je voudrait avoir un style de fonction > > > > //code voulu pour plusieur photo a la fois :P > > function.zoom(valeur) { > > if (img + valeur + ._height < 339) { > > img + valeur + ._height = img + valeur + ._height * 1.5; > > img + valeur + ._width = img + valeur + ._width * 1.5; > > cadrephoto._height = img + valeur + ._height + 40; > > cadrephoto._width = img + valeur + ._width + 40; > > } > > > > } > > > > et apres faire mon action de bouton avec > > > > on (press) { > > valeur = compteur; > > zoom(valeur); > > } > > > > > > > > SVP si quelqu un sait si c'est possible repondez moi :) >
|
|
mardi 6 mai 2003 à 20:58:17 |
Re : J'aimerai faire une fonction avec un argument ???

tombal
|
LOL tu a oublié des _ dans _height enfin c'est plutot moi qui les ais oublié ;)
function zoom(x) { _root.["img"+x]._height = _root.["img"+x]._height * 1.5; _root.["img"+x]._width = _root.["img"+x]._width * 1.5; cadrephoto._height = _root.["img"+x]._height + 40; cadrephoto._width = _root.["img"+x]._width + 40; }
Tombal
------------------------------- Réponse au message : -------------------------------
> Merci tu ma bien compris a ce que je voit j ai tester et je ny arrive pas. Avec l aide quej ai trouver dans le dictionnaire action script je voit bien que tu as raison Mais j ai tj des erreur quand je compile > > j ai pourtant fait ma fonction comme tu me la montrer > c'est peut-etre que je ne sait pas ou mettre ma fonction > la c'est dans la meme séquence et dans la scene 1 > la scene de mon fond de mon site > > function zoom(x) { > _root.["img"+x].height = _root.["img"+x].height * 1.5; > _root.["img"+x].width = _root.["img"+x].width * 1.5; > cadrephoto._height = _root.["img"+x].height + 40; > cadrephoto._width = _root.["img"+x].width + 40; > } > > > jai ses 4 erreur la une pour chaque ligne > Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > (meme erreur pour les 4 lignes) > > > et la fonction elle est declancher par un bouton avec > on (press) { > zoom(compteur); > } > > compteur etant le numero de l image > > > Je fait plein de test en attendant ta reponse :) > > ------------------------------- > Réponse au message : > ------------------------------- > > > Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe > > > > Pour une fonction : > > function nom_de_fonction (parametre) { > > //code > > } > > > > Pour l'histoire du img1, img2... > > _root["img"+x]._height = valeur > > > > > > exemple : > > function zoom (x,aggrandissement) { > > _root.["img"+x].height = _root.["img"+x].height*aggrandissement; > > //Tu fais praeil avec le reste > > } > > > > //pour zoomer l'image 3 d'un facteur 2 > > zoom (3,2); > > > > Tombal > > > > ------------------------------- > > Réponse au message : > > ------------------------------- > > > > > Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > > > > > ex pour le zoom > > > > > > > > > //code actuel sans fonction pour 2 photos > > > on (press) { > > > if ((compteur == 1) && (img1._height < 339)) { > > > img1._height = img1._height * 1.5; > > > img1._width = img1._width * 1.5; > > > cadrephoto._height = img1._height + 40; > > > cadrephoto._width = img1._width + 40; > > > } > > > if ((compteur == 2) && (img2._height < 339)) { > > > img2._height = img2._height * 1.5; > > > img2._width = img2._width * 1.5; > > > cadrephoto._height = img2._height + 40; > > > cadrephoto._width = img2._width + 40; > > > } > > > > > > } > > > > > > > > > Je voudrait avoir un style de fonction > > > > > > //code voulu pour plusieur photo a la fois :P > > > function.zoom(valeur) { > > > if (img + valeur + ._height < 339) { > > > img + valeur + ._height = img + valeur + ._height * 1.5; > > > img + valeur + ._width = img + valeur + ._width * 1.5; > > > cadrephoto._height = img + valeur + ._height + 40; > > > cadrephoto._width = img + valeur + ._width + 40; > > > } > > > > > > } > > > > > > et apres faire mon action de bouton avec > > > > > > on (press) { > > > valeur = compteur; > > > zoom(valeur); > > > } > > > > > > > > > > > > SVP si quelqu un sait si c'est possible repondez moi :) > > >
|
|
mardi 6 mai 2003 à 21:00:35 |
Re : J'aimerai faire une fonction avec un argument ???

tombal
|
Autre chose que j'ai pas vu, tu a mis de spoint la ou j'en ai pas mis =) entre le _root et les crochet, il ne faut pas de point
function zoom(x) { _root["img"+x]._height = _root["img"+x]._height * 1.5; _root["img"+x]._width = _root.["img"+x]._width * 1.5; cadrephoto._height = _root["img"+x]._height + 40; cadrephoto._width = _root["img"+x]._width + 40; }
Tombal
------------------------------- Réponse au message : -------------------------------
> LOL tu a oublié des _ dans _height > enfin c'est plutot moi qui les ais oublié ;) > > function zoom(x) { > _root.["img"+x]._height = _root.["img"+x]._height * 1.5; > _root.["img"+x]._width = _root.["img"+x]._width * 1.5; > cadrephoto._height = _root.["img"+x]._height + 40; > cadrephoto._width = _root.["img"+x]._width + 40; > } > > Tombal > > ------------------------------- > Réponse au message : > ------------------------------- > > > Merci tu ma bien compris a ce que je voit j ai tester et je ny arrive pas. Avec l aide quej ai trouver dans le dictionnaire action script je voit bien que tu as raison Mais j ai tj des erreur quand je compile > > > > j ai pourtant fait ma fonction comme tu me la montrer > > c'est peut-etre que je ne sait pas ou mettre ma fonction > > la c'est dans la meme séquence et dans la scene 1 > > la scene de mon fond de mon site > > > > function zoom(x) { > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > _root.["img"+x].width = _root.["img"+x].width * 1.5; > > cadrephoto._height = _root.["img"+x].height + 40; > > cadrephoto._width = _root.["img"+x].width + 40; > > } > > > > > > jai ses 4 erreur la une pour chaque ligne > > Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > > > (meme erreur pour les 4 lignes) > > > > > > et la fonction elle est declancher par un bouton avec > > on (press) { > > zoom(compteur); > > } > > > > compteur etant le numero de l image > > > > > > Je fait plein de test en attendant ta reponse :) > > > > ------------------------------- > > Réponse au message : > > ------------------------------- > > > > > Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe > > > > > > Pour une fonction : > > > function nom_de_fonction (parametre) { > > > //code > > > } > > > > > > Pour l'histoire du img1, img2... > > > _root["img"+x]._height = valeur > > > > > > > > > exemple : > > > function zoom (x,aggrandissement) { > > > _root.["img"+x].height = _root.["img"+x].height*aggrandissement; > > > //Tu fais praeil avec le reste > > > } > > > > > > //pour zoomer l'image 3 d'un facteur 2 > > > zoom (3,2); > > > > > > Tombal > > > > > > ------------------------------- > > > Réponse au message : > > > ------------------------------- > > > > > > > Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > > > > > > > ex pour le zoom > > > > > > > > > > > > //code actuel sans fonction pour 2 photos > > > > on (press) { > > > > if ((compteur == 1) && (img1._height < 339)) { > > > > img1._height = img1._height * 1.5; > > > > img1._width = img1._width * 1.5; > > > > cadrephoto._height = img1._height + 40; > > > > cadrephoto._width = img1._width + 40; > > > > } > > > > if ((compteur == 2) && (img2._height < 339)) { > > > > img2._height = img2._height * 1.5; > > > > img2._width = img2._width * 1.5; > > > > cadrephoto._height = img2._height + 40; > > > > cadrephoto._width = img2._width + 40; > > > > } > > > > > > > > } > > > > > > > > > > > > Je voudrait avoir un style de fonction > > > > > > > > //code voulu pour plusieur photo a la fois :P > > > > function.zoom(valeur) { > > > > if (img + valeur + ._height < 339) { > > > > img + valeur + ._height = img + valeur + ._height * 1.5; > > > > img + valeur + ._width = img + valeur + ._width * 1.5; > > > > cadrephoto._height = img + valeur + ._height + 40; > > > > cadrephoto._width = img + valeur + ._width + 40; > > > > } > > > > > > > > } > > > > > > > > et apres faire mon action de bouton avec > > > > > > > > on (press) { > > > > valeur = compteur; > > > > zoom(valeur); > > > > } > > > > > > > > > > > > > > > > SVP si quelqu un sait si c'est possible repondez moi :) > > > > > >
|
|
mardi 6 mai 2003 à 21:03:17 |
Re : J'aimerai faire une fonction avec un argument ???

tombal
|
ROOOOOO Je suis fatigué aujourd'hui, excuse moi....... (c le stress des exam) C moi qui ais mis des point partout et oublier des trucs
Bon voici le bon code function zoom(x) { _root["img"+x]._height = _root["img"+x]._height * 1.5; _root["img"+x]._width = _root["img"+x]._width * 1.5; cadrephoto._height = _root["img"+x]._height + 40; cadrephoto._width = _root["img"+x]._width + 40; }
Tombal
------------------------------- Réponse au message : -------------------------------
> Autre chose que j'ai pas vu, tu a mis de spoint la ou j'en ai pas mis =) > entre le _root et les crochet, il ne faut pas de point > > function zoom(x) { > _root["img"+x]._height = _root["img"+x]._height * 1.5; > _root["img"+x]._width = _root.["img"+x]._width * 1.5; > cadrephoto._height = _root["img"+x]._height + 40; > cadrephoto._width = _root["img"+x]._width + 40; > } > > Tombal > > > ------------------------------- > Réponse au message : > ------------------------------- > > > LOL tu a oublié des _ dans _height > > enfin c'est plutot moi qui les ais oublié ;) > > > > function zoom(x) { > > _root.["img"+x]._height = _root.["img"+x]._height * 1.5; > > _root.["img"+x]._width = _root.["img"+x]._width * 1.5; > > cadrephoto._height = _root.["img"+x]._height + 40; > > cadrephoto._width = _root.["img"+x]._width + 40; > > } > > > > Tombal > > > > ------------------------------- > > Réponse au message : > > ------------------------------- > > > > > Merci tu ma bien compris a ce que je voit j ai tester et je ny arrive pas. Avec l aide quej ai trouver dans le dictionnaire action script je voit bien que tu as raison Mais j ai tj des erreur quand je compile > > > > > > j ai pourtant fait ma fonction comme tu me la montrer > > > c'est peut-etre que je ne sait pas ou mettre ma fonction > > > la c'est dans la meme séquence et dans la scene 1 > > > la scene de mon fond de mon site > > > > > > function zoom(x) { > > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > > _root.["img"+x].width = _root.["img"+x].width * 1.5; > > > cadrephoto._height = _root.["img"+x].height + 40; > > > cadrephoto._width = _root.["img"+x].width + 40; > > > } > > > > > > > > > jai ses 4 erreur la une pour chaque ligne > > > Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. > > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > > > > > (meme erreur pour les 4 lignes) > > > > > > > > > et la fonction elle est declancher par un bouton avec > > > on (press) { > > > zoom(compteur); > > > } > > > > > > compteur etant le numero de l image > > > > > > > > > Je fait plein de test en attendant ta reponse :) > > > > > > ------------------------------- > > > Réponse au message : > > > ------------------------------- > > > > > > > Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe > > > > > > > > Pour une fonction : > > > > function nom_de_fonction (parametre) { > > > > //code > > > > } > > > > > > > > Pour l'histoire du img1, img2... > > > > _root["img"+x]._height = valeur > > > > > > > > > > > > exemple : > > > > function zoom (x,aggrandissement) { > > > > _root.["img"+x].height = _root.["img"+x].height*aggrandissement; > > > > //Tu fais praeil avec le reste > > > > } > > > > > > > > //pour zoomer l'image 3 d'un facteur 2 > > > > zoom (3,2); > > > > > > > > Tombal > > > > > > > > ------------------------------- > > > > Réponse au message : > > > > ------------------------------- > > > > > > > > > Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > > > > > > > > > ex pour le zoom > > > > > > > > > > > > > > > //code actuel sans fonction pour 2 photos > > > > > on (press) { > > > > > if ((compteur == 1) && (img1._height < 339)) { > > > > > img1._height = img1._height * 1.5; > > > > > img1._width = img1._width * 1.5; > > > > > cadrephoto._height = img1._height + 40; > > > > > cadrephoto._width = img1._width + 40; > > > > > } > > > > > if ((compteur == 2) && (img2._height < 339)) { > > > > > img2._height = img2._height * 1.5; > > > > > img2._width = img2._width * 1.5; > > > > > cadrephoto._height = img2._height + 40; > > > > > cadrephoto._width = img2._width + 40; > > > > > } > > > > > > > > > > } > > > > > > > > > > > > > > > Je voudrait avoir un style de fonction > > > > > > > > > > //code voulu pour plusieur photo a la fois :P > > > > > function.zoom(valeur) { > > > > > if (img + valeur + ._height < 339) { > > > > > img + valeur + ._height = img + valeur + ._height * 1.5; > > > > > img + valeur + ._width = img + valeur + ._width * 1.5; > > > > > cadrephoto._height = img + valeur + ._height + 40; > > > > > cadrephoto._width = img + valeur + ._width + 40; > > > > > } > > > > > > > > > > } > > > > > > > > > > et apres faire mon action de bouton avec > > > > > > > > > > on (press) { > > > > > valeur = compteur; > > > > > zoom(valeur); > > > > > } > > > > > > > > > > > > > > > > > > > > SVP si quelqu un sait si c'est possible repondez moi :) > > > > > > > > > >
|
|
mardi 6 mai 2003 à 21:04:17 |
Re : J'aimerai faire une fonction avec un argument ???

Martino26
|
Au moment ou tu ma repondu je venait d allumer cette erreur aussi lol mais j ai toujour cette erreur c comme si il voit pas img + x j ai donc essayer aussi avec _root.img[x]._height mais rien de plus j allume vraiment pas :P
Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. > _root.["img"+x].height = _root.["img"+x]._height * 1.5;
------------------------------- Réponse au message : -------------------------------
> LOL tu a oublié des _ dans _height > enfin c'est plutot moi qui les ais oublié ;) > > function zoom(x) { > _root.["img"+x]._height = _root.["img"+x]._height * 1.5; > _root.["img"+x]._width = _root.["img"+x]._width * 1.5; > cadrephoto._height = _root.["img"+x]._height + 40; > cadrephoto._width = _root.["img"+x]._width + 40; > } > > Tombal > > ------------------------------- > Réponse au message : > ------------------------------- > > > Merci tu ma bien compris a ce que je voit j ai tester et je ny arrive pas. Avec l aide quej ai trouver dans le dictionnaire action script je voit bien que tu as raison Mais j ai tj des erreur quand je compile > > > > j ai pourtant fait ma fonction comme tu me la montrer > > c'est peut-etre que je ne sait pas ou mettre ma fonction > > la c'est dans la meme séquence et dans la scene 1 > > la scene de mon fond de mon site > > > > function zoom(x) { > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > _root.["img"+x].width = _root.["img"+x].width * 1.5; > > cadrephoto._height = _root.["img"+x].height + 40; > > cadrephoto._width = _root.["img"+x].width + 40; > > } > > > > > > jai ses 4 erreur la une pour chaque ligne > > Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > > > (meme erreur pour les 4 lignes) > > > > > > et la fonction elle est declancher par un bouton avec > > on (press) { > > zoom(compteur); > > } > > > > compteur etant le numero de l image > > > > > > Je fait plein de test en attendant ta reponse :) > > > > ------------------------------- > > Réponse au message : > > ------------------------------- > > > > > Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe > > > > > > Pour une fonction : > > > function nom_de_fonction (parametre) { > > > //code > > > } > > > > > > Pour l'histoire du img1, img2... > > > _root["img"+x]._height = valeur > > > > > > > > > exemple : > > > function zoom (x,aggrandissement) { > > > _root.["img"+x].height = _root.["img"+x].height*aggrandissement; > > > //Tu fais praeil avec le reste > > > } > > > > > > //pour zoomer l'image 3 d'un facteur 2 > > > zoom (3,2); > > > > > > Tombal > > > > > > ------------------------------- > > > Réponse au message : > > > ------------------------------- > > > > > > > Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > > > > > > > ex pour le zoom > > > > > > > > > > > > //code actuel sans fonction pour 2 photos > > > > on (press) { > > > > if ((compteur == 1) && (img1._height < 339)) { > > > > img1._height = img1._height * 1.5; > > > > img1._width = img1._width * 1.5; > > > > cadrephoto._height = img1._height + 40; > > > > cadrephoto._width = img1._width + 40; > > > > } > > > > if ((compteur == 2) && (img2._height < 339)) { > > > > img2._height = img2._height * 1.5; > > > > img2._width = img2._width * 1.5; > > > > cadrephoto._height = img2._height + 40; > > > > cadrephoto._width = img2._width + 40; > > > > } > > > > > > > > } > > > > > > > > > > > > Je voudrait avoir un style de fonction > > > > > > > > //code voulu pour plusieur photo a la fois :P > > > > function.zoom(valeur) { > > > > if (img + valeur + ._height < 339) { > > > > img + valeur + ._height = img + valeur + ._height * 1.5; > > > > img + valeur + ._width = img + valeur + ._width * 1.5; > > > > cadrephoto._height = img + valeur + ._height + 40; > > > > cadrephoto._width = img + valeur + ._width + 40; > > > > } > > > > > > > > } > > > > > > > > et apres faire mon action de bouton avec > > > > > > > > on (press) { > > > > valeur = compteur; > > > > zoom(valeur); > > > > } > > > > > > > > > > > > > > > > SVP si quelqu un sait si c'est possible repondez moi :) > > > > > >
|
|
mardi 6 mai 2003 à 21:20:39 |
Re : J'aimerai faire une fonction avec un argument ???

Martino26
|
Parfait ca !! merci bien mec je t en doit une :) tanks pour ta patience besoin de quoi que se soit je suis sur mirc undernet sur #irc-jeux pseudo Martino26 @+
------------------------------- Réponse au message : -------------------------------
> ROOOOOO > Je suis fatigué aujourd'hui, excuse moi....... > (c le stress des exam) > C moi qui ais mis des point partout et oublier des trucs > > Bon voici le bon code > function zoom(x) { > _root["img"+x]._height = _root["img"+x]._height * 1.5; > _root["img"+x]._width = _root["img"+x]._width * 1.5; > cadrephoto._height = _root["img"+x]._height + 40; > cadrephoto._width = _root["img"+x]._width + 40; > } > > Tombal > > > ------------------------------- > Réponse au message : > ------------------------------- > > > Autre chose que j'ai pas vu, tu a mis de spoint la ou j'en ai pas mis =) > > entre le _root et les crochet, il ne faut pas de point > > > > function zoom(x) { > > _root["img"+x]._height = _root["img"+x]._height * 1.5; > > _root["img"+x]._width = _root.["img"+x]._width * 1.5; > > cadrephoto._height = _root["img"+x]._height + 40; > > cadrephoto._width = _root["img"+x]._width + 40; > > } > > > > Tombal > > > > > > ------------------------------- > > Réponse au message : > > ------------------------------- > > > > > LOL tu a oublié des _ dans _height > > > enfin c'est plutot moi qui les ais oublié ;) > > > > > > function zoom(x) { > > > _root.["img"+x]._height = _root.["img"+x]._height * 1.5; > > > _root.["img"+x]._width = _root.["img"+x]._width * 1.5; > > > cadrephoto._height = _root.["img"+x]._height + 40; > > > cadrephoto._width = _root.["img"+x]._width + 40; > > > } > > > > > > Tombal > > > > > > ------------------------------- > > > Réponse au message : > > > ------------------------------- > > > > > > > Merci tu ma bien compris a ce que je voit j ai tester et je ny arrive pas. Avec l aide quej ai trouver dans le dictionnaire action script je voit bien que tu as raison Mais j ai tj des erreur quand je compile > > > > > > > > j ai pourtant fait ma fonction comme tu me la montrer > > > > c'est peut-etre que je ne sait pas ou mettre ma fonction > > > > la c'est dans la meme séquence et dans la scene 1 > > > > la scene de mon fond de mon site > > > > > > > > function zoom(x) { > > > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > > > _root.["img"+x].width = _root.["img"+x].width * 1.5; > > > > cadrephoto._height = _root.["img"+x].height + 40; > > > > cadrephoto._width = _root.["img"+x].width + 40; > > > > } > > > > > > > > > > > > jai ses 4 erreur la une pour chaque ligne > > > > Séquence = site, Calque = FOND, Image = 1 : Ligne 44 : Un nom de champ est attendu après l'opérateur '.'. > > > > _root.["img"+x].height = _root.["img"+x].height * 1.5; > > > > > > > > (meme erreur pour les 4 lignes) > > > > > > > > > > > > et la fonction elle est declancher par un bouton avec > > > > on (press) { > > > > zoom(compteur); > > > > } > > > > > > > > compteur etant le numero de l image > > > > > > > > > > > > Je fait plein de test en attendant ta reponse :) > > > > > > > > ------------------------------- > > > > Réponse au message : > > > > ------------------------------- > > > > > > > > > Bon vu que tu sais ce qu'il faut faire, je te donne la syntaxe > > > > > > > > > > Pour une fonction : > > > > > function nom_de_fonction (parametre) { > > > > > //code > > > > > } > > > > > > > > > > Pour l'histoire du img1, img2... > > > > > _root["img"+x]._height = valeur > > > > > > > > > > > > > > > exemple : > > > > > function zoom (x,aggrandissement) { > > > > > _root.["img"+x].height = _root.["img"+x].height*aggrandissement; > > > > > //Tu fais praeil avec le reste > > > > > } > > > > > > > > > > //pour zoomer l'image 3 d'un facteur 2 > > > > > zoom (3,2); > > > > > > > > > > Tombal > > > > > > > > > > ------------------------------- > > > > > Réponse au message : > > > > > ------------------------------- > > > > > > > > > > > Bonjour je fait un site web avec des images et des zoom sur les images et je veut faire des fonction avec des argument pour qu il soit plus facile d ajouter des images plustard et optimiser mon code en meme temps > > > > > > > > > > > > ex pour le zoom > > > > > > > > > > > > > > > > > > //code actuel sans fonction pour 2 photos > > > > > > on (press) { > > > > > > if ((compteur == 1) && (img1._height < 339)) { > > > > > > img1._height = img1._height * 1.5; > > > > > > img1._width = img1._width * 1.5; > > > > > > cadrephoto._height = img1._height + 40; > > > > > > cadrephoto._width = img1._width + 40; > > > > > > } > > > > > > if ((compteur == 2) && (img2._height < 339)) { > > > > > > img2._height = img2._height * 1.5; > > > > > > img2._width = img2._width * 1.5; > > > > > > cadrephoto._height = img2._height + 40; > > > > > > cadrephoto._width = img2._width + 40; > > > > > > } > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > Je voudrait avoir un style de fonction > > > > > > > > > > > > //code voulu pour plusieur photo a la fois :P > > > > > > function.zoom(valeur) { > > > > > > if (img + valeur + ._height < 339) { > > > > > > img + valeur + ._height = img + valeur + ._height * 1.5; > > > > > > img + valeur + ._width = img + valeur + ._width * 1.5; > > > > > > cadrephoto._height = img + valeur + ._height + 40; > > > > > > cadrephoto._width = img + valeur + ._width + 40; > > > > > > } > > > > > > > > > > > > } > > > > > > > > > > > > et apres faire mon action de bouton avec > > > > > > > > > > > > on (press) { > > > > > > valeur = compteur; > > > > > > zoom(valeur); > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > SVP si quelqu un sait si c'est possible repondez moi :) > > > > > > > > > > > > > > >
|
|
Cette discussion est classée dans : valeur, width, height, img1, img2
Répondre à ce message
Sujets en rapport avec ce message
creer une image à partir d'une autre [ par abdelkaoui ]
Bonjour à tous.dans mon projet je doit selectionner une partie d'une image(la selection se fait par un cadre dont le fond est transparent). c'est à di
comment centrer une popup à l'écran? [ par Oncle Simous ]
Voilà mon code pour ouvrir une simple popup directement à l'ouverture du SWF... La popup s'ouvre de la bonne taille mais n'est pas centrée à l'écan :(
galere pop-ups [ par ]
Salut a tous ! A l'aide je galere severe avec les pop-ups.Voila sur ma page j'ai 4 images de petite taille que je voudrais ouvrir sur un click chacune
galere pop-ups [ par ]
Salut a tous ! A l'aide je galere severe avec les pop-ups.Voila sur ma page j'ai 4 images de petite taille que je voudrais ouvrir sur un click chacune
images et taille [ par nicoxidine ]
bonjour,je charge une image externe et je souhaitrais modifier sa taille, malheuresement ça ne fonctionne pas et je ne sais pas comment faire. j'ai re
Problème taille swf height et width [ par actaruss ]
Salut les amis, je voudrais charger plusieurs swf dans une anim flash, avec un affichage miniature et plein zoomé.Exemple : J'ai un clip nommé "charge
Popup en java mais forcage en premier plan et ré-actualiser à chaque popup (pas cacher en arrière plan) [ par webed ]
Bonjour, J'ai un FLA avec un lien qui ouvre une popup : on (release) { getURL("javascript:openWindownews(610,450)"); } Dans la page HTML ou se trou
gallerie xml/image cliquable [ par jahrom1 ]
bonjour j'ai toujours un souci avec ma gallerie xml de reussir a rendre chaque image cliquable et de m'afficher la fiche technique correpondante a l'i
Probleme pour ouvrir 2 SWF en popup [ par croftman ]
Bonjour,J'ai une intro sur un site qui une fois finis doit ouvrir 2 swf, j'ai mis ca dans le code du bouton:on (press) { getURL("javascript:open('site
Murs [ par Leo17 ]
Bonjour,Je voudrais faire rebondir une balle sur un mur. J'ai trouvé un tutorial pour ça, j'ai réussi à faire avancer ma balle, mais le code pour la f
Livres en rapport
|
Derniers Blogs
IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) par richardc
Mise à jour des Web API du 14 Mai
Réservez dès maintenant votre journée du 20 juin pour le Windows Azure Dev Camp 2012 à Paris
Mise à jour de Team Foundation Service
MechCommander 2 sur Windows 8
Entity Framework 5 Release Candidate e...
Cliquez pour lire la suite de l'article par richardc REACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITERREACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITER par Groc
Une mauvaise utilisation de rx lors de l'écriture d'une couche d'accès à des services peut conduire à des cas embarassants avec des erreurs mal gérées, des appels qui ne partent lorsqu'ils le devraient, et même des résultats incorrects . le tout nuis...
Cliquez pour lire la suite de l'article par Groc SHAREPOINT BLOG SITE, PROBLèME D'ARCHIVESSHAREPOINT BLOG SITE, PROBLèME D'ARCHIVES par junarnoalg
Dernièrement, nous avons migré le site
myTIC
vers un nouveau serveur SharePoint 2010. Dans les contenus que nous vouloins récupérer, nous avions un certain nombre de blogs.
Nous avons utilisé les commandes Power...
Cliquez pour lire la suite de l'article par junarnoalg
Logiciels
sDEVIS-FACTURES vlPRO (8.1.0.3)SDEVIS-FACTURES VLPRO (8.1.0.3)sDEVIS-FACTURES vlPRO a été mis au point pour les particuliers, créateurs, entrepreneurs, artisa... Cliquez pour télécharger sDEVIS-FACTURES vlPRO 974 Application Server (12.2.4.6)974 APPLICATION SERVER (12.2.4.6)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP
|