Sharedobject

Résolu
pho3nixhunt3r Messages postés 6 Date d'inscription lundi 5 mai 2008 Statut Membre Dernière intervention 16 juillet 2008 - 16 mai 2008 à 15:17
pho3nixhunt3r Messages postés 6 Date d'inscription lundi 5 mai 2008 Statut Membre Dernière intervention 16 juillet 2008 - 16 mai 2008 à 23:46
Bonjour,
voila je crée un site avec des dossiers que l'on peut déplacer (drag and drop),
avec aussi un double clic (getTimer)
et je souhaiterai que le tout soit stocker en cookies afin que les dossier garde la place que l'utilisateur leur aura alouée.
C'est la que ça coince je débute en script et là ça commence a faire trop gros, tout marche sauf les cookie.
quelqu'un pourai m'aider ??

d'avance merci :

stop();

var deplace:Boolean = false;
var premierClic = 0;
var leCookie = SharedObjet.getLocal("visite");

if (leCookie.data.visite == undefined){
    leCookie.data.visite = "oui";
    var coordX = [];
    var coordY = [];
}else{
    var leCookie = SharedObjet.getLocal("undergroundstudio");
    coordX = leCookie.data.coordX;
    coordY = leCookie.data.coordY;
    for (i=1; i<=3; i++){
        _root["dossier"+i]._x = coordX[i-1];
        _root["dossier"+i]._y = coordY[i-1];
    }
}

if(!son){
    _root.sons_intro.start(0,0);
    var son:Boolean = true;
}

this.dossier1.onPress = function(){
    this.startDrag(false ,10 ,0 ,820 ,410);
    deplace = true;
    if (getTimer()-premierClic<400){
        this._parent.gotoAndPlay(2);
    }
    premierClic = getTimer();
}
this.dossier1.onRelease = this.dossier1.onReleaseOutside=function(){
stopDrag();
entreeCoords = this._name.substr(4, 1);
coordX[entreeCoords-1] = this._x;
coordY[entreeCoords-1] = this._y;
leCookie.data.coordX = coordX;
leCookie.data.coordY = coordY;
}

this.dossier2.onPress = function(){
    this.startDrag(false ,10 ,0 ,820 ,410);
    deplace = true;
    if (getTimer()-premierClic<400){
        this._parent.gotoAndPlay(3);
    }
    premierClic = getTimer();
}
this.dossier2.onRelease = this.dossier2.onReleaseOutside=function(){
stopDrag()
entreeCoords = this._name.substr(4, 1);
coordX[entreeCoords-1] = this._x;
coordY[entreeCoords-1] = this._y;
leCookie.data.coordX = coordX;
leCookie.data.coordY = coordY;
}

this.dossier3.onPress = function(){
    this.startDrag(false ,10 ,0 ,820 ,410);
    deplace = true;
    if (getTimer()-premierClic<400){
        this._parent.gotoAndPlay(4);
    }
    premierClic = getTimer();
}
this.dossier3.onRelease = this.dossier3.onReleaseOutside=function(){
stopDrag();
entreeCoords = this._name.substr(4, 1);
coordX[entreeCoords-1] = this._x;
coordY[entreeCoords-1] = this._y;
leCookie.data.coordX = coordX;
leCookie.data.coordY = coordY;
}

if(deplace == true){
    var leCookie = SharedObject.getLocal("undergroundstudio");
    leCookie.data.coordX = coordX;
    leCookie.data.coordY = coordY;
}

1 réponse

pho3nixhunt3r Messages postés 6 Date d'inscription lundi 5 mai 2008 Statut Membre Dernière intervention 16 juillet 2008
16 mai 2008 à 23:46
Résolu par moi même merci
3
Rejoignez-nous