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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
var nbFG:Number = 0;
FG_mc.onRelease = function(){
var sNom:String = "FGauche-"+nbFG+"_mc";
// ou : var sNom:String = "FGauche-"+nbFG+"_btn";
// si c'est un symbole de type bouton
var nProfondeur:Number = nbFG+nbFD+nbFB+nbFH;
var mcDuplicate:MovieClip = this.duplicateMovieClip(sNom, nProfondeur, {_x:(CadreDessin._x+800), _y:(CadreDessin._y+20)});
mcDuplicate.id = id;
mcDuplicate.onPress = function()
{
this.startDrag();
// enregistrement des coordonnées DANS le mc à l'aide de this
this.posX = ModificationCoordonnees( this._x )-20;
this.posY = ModificationCoordonnees( this._y )-110;
trace("XG = "+ (ModificationCoordonnees( this._x )-20) );
trace("YG = "+ (ModificationCoordonnees( this._y )-110) );
};
mcDuplicate.onRelease = function()
{
this.stopDrag();
// enregistrement des coordonnées DANS le mc à l'aide de this
this.posX = ModificationCoordonnees( this._x )-20;
this.posY = ModificationCoordonnees( this._y )-110;
trace("XG = "+ (ModificationCoordonnees( this._x )-20) );
trace("YG = "+ (ModificationCoordonnees( this._y )-110) );
};
nbFG++;
}
BtnEffacerFleches.onRelease = function ()
{
EffacerFleches();
}
function EffacerFleches()
{
for( q = 0 ; q <= nbFG ; q++ )
{
removeMovieClip("FGauche-" + q + "_mc");
}
nbFG = 0;
}
BoutonSuivant.onPress = function()
{
// stockage fleches G, D, B, H x et y
var XG:String = "";
var YG:String = "";
for( k = 0 ; k < nbFG ; k++)
{
XG += this._parent["FGauche-"+k+"_mc"].posX;
XG += "_";
YG += this._parent["FGauche-"+k+"_mc"].posY;
YG += "_";
}
trace("XG = "+XG+" / YG = "+YG);
EffacerFleches();
} |