1 pièce(s) jointe(s)
Algorithme pour une animation flash
Bonjour à tous,
Je suis dans une entreprise et je doit faire adaptée une animation flash à mes besoins.
Voilà le problème : je récupère une liste d'images (aucun problème ici) et je dois en faire 6 colonnes de 5 images => voir l'image jointe
J'essaie donc de placer les colonnes les unes à côté des autres sachant que :
- la colonne 1 doit être composée de l'image 1 à l'image 5
- la colonne 2 doit être composée de l'image 6 à l'image 10
- etc
Voici ce que j'ai fait (dans flash) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// Déplacement et redimensionnement du clip conteneur:
//NbImages = gallerieNbr
_root.Positiony = 0; // Position en y
_root.NbColonnes = 6; // Nb de colonnes
_root.NbImgParColonne = 5;// Nb d'images par colonne
_root.ColonneCourante = 0; // Colonne courant
_root.position = 0; // Position en x
_root.Reste = _root.gallerieNbr; // Nb d'images restantes
for(i=0;i<_root.gallerieNbr;i++){
// récupération des dimmenssions d'origine
_root.image01["bitmap_mc"+i].width = _root.image01["bitmap_mc"+i]._width;
_root.image01["bitmap_mc"+i].height = _root.image01["bitmap_mc"+i]._height;
_root.image02["bitmap_mc"+i].width = _root.image01["bitmap_mc"+i]._width;
_root.image02["bitmap_mc"+i].height = _root.image01["bitmap_mc"+i]._height;
// réduit l'image originale à la hauteur définie
_root.image01["bitmap_mc"+i]._width = _root.image02["bitmap_mc"+i]._width = (_root.image01["bitmap_mc"+i]._width * _root.Hauteur) / _root.image01["bitmap_mc"+i]._height;
_root.image01["bitmap_mc"+i]._height = _root.image02["bitmap_mc"+i]._height = _root.Hauteur;
}
i=0;
if (_root.Reste>0) {
while (_root.ColonneCourante<_root.NbColonnes) {
_root.ColonneCourante++;
while (i<_root.NbImgParColonne) {
//maintenant on dispose les images à partir de x=0 et y=0
i++;
_root.image01["bitmap_mc"+i]._y = _root.image02["bitmap_mc"+i]._y = _root.Positiony;
_root.image01["bitmap_mc"+i]._x= _root.image02["bitmap_mc"+i]._x = _root.position;
_root.Positiony += _root.image01["bitmap_mc"+i]._height ;
_root.Reste = _root.Reste - 1;
}
_root.position += 127;
}
} |
Je pense que ce n'ai pas grand chose. :?:?:?