Conversion as2 en as3

clairedesire Messages postés 1 Date d'inscription jeudi 10 décembre 2009 Statut Membre Dernière intervention 16 février 2010 - 16 févr. 2010 à 16:05
pegase31 Messages postés 6138 Date d'inscription dimanche 21 décembre 2003 Statut Modérateur Dernière intervention 4 septembre 2013 - 16 févr. 2010 à 18:41
Bonjour,

Débutante en programmation j'essaie de convertir un code as2 en as3. Il s'agit d'une galerie photo relativement simple. J'ai commencé une approche de "traduction" mais sans succès. Est-ce que quelqu'un pourrait m'aider?

merci,

claire

voici mon code :


stop();

//les stops et chargement des images//
touslesbtns.dec09.onRelease=function(){
gotoAndStop(3);
}
touslesbtns.accro07.onRelease=function(){
gotoAndStop(2);
}
touslesbtns.lille07.onRelease=function(){
gotoAndStop(1);
}

_root.createEmptyMovieClip("cadreChargementPhoto", 0);
cadreChargementPhoto._x = 205;
cadreChargementPhoto._y = 25;
cadreChargementPhoto.loadMovie("photoslille07/lille1.jpg");
vLegende = ("Photo de Lille 1");

var chargeLegendes = new XML();
chargeLegendes.load("photoslille.xml");
chargeLegendes.ignoreWhite = true;
chargeLegendes.onLoad = function() {
racineLegendes = this.firstChild;
nbrSeries = Math.ceil((racineLegendes.childNodes.length-1)/6);
affNbrSeries = ("page 1"+"/"+nbrSeries);
};

for (i=1; i<=6; i++) {
_root.createEmptyMovieClip("image"+i, i);
_root["image"+i]._x = 70;
_root["image"+i]._y = (i*68)-30;
}

var premiereImageChargee = 0;

chargementSerie = function (imageAcharger) {
for (i=1; i<=6; i++) {
imageAcharger++;
_root["chargeur"+i] = new MovieClipLoader();
_root["chargeur"+i].sonNumero = i;
_root["chargeur"+i].saGrandePhoto = imageAcharger;
_root["chargeur"+i].onLoadComplete = function() {
_root["image"+this.sonNumero].saGrandePhoto = this.saGrandePhoto;
_root["image"+this.sonNumero].onRollOver = function() {
this._alpha = 70;
}
_root["image"+this.sonNumero].onRollOut = function() {
this._alpha = 100;
}
_root["image"+this.sonNumero].onPress = function() {

import mx.transitions.Tween;
var myTween:Tween = new Tween(cadreChargementPhoto, "_alpha",mx.transitions.easing.Strong.easeOut, 0,100, 5, true);

cadreChargementPhoto.loadMovie("photoslille07/lille"+this.saGrandePhoto+".jpg");
vLegende = racineLegendes.childNodes[this.saGrandePhoto].attributes.legende;
};

};
_root["chargeur"+i].loadClip("vignetteslille07/v"+imageAcharger+".jpg", _root["image"+i]);
}
affNbrSeries = ("page "+(Math.floor(imageAcharger/6))+"/"+nbrSeries);
};

chargementSerie(premiereImageChargee);

btSerieSuivante.onPress = function() {
if (premiereImageChargee<racineLegendes.childNodes.length-7) {
premiereImageChargee +=6;
}
chargementSerie(premiereImageChargee);
};
btSeriePrecedente.onPress = function() {
if (premiereImageChargee>=6) {
premiereImageChargee -= 6;
}
chargementSerie(premiereImageChargee);
};

1 réponse

pegase31 Messages postés 6138 Date d'inscription dimanche 21 décembre 2003 Statut Modérateur Dernière intervention 4 septembre 2013 12
16 févr. 2010 à 18:41
Bonsoir,

Soucis récurent ...

L'AS2 et l'AS3 ont tellement de différence dans le concept graphique (par exemple) qu'une "traduction" est souvent inutile tellement il y a des choses à revoir. Le plus simple est de refaire tout à zéro pour réellement profiter de la puissance amenée par cette nouvelle version de code.

Peg'
0
Rejoignez-nous