Recuperer variables par url.

ropi59 Messages postés 10 Date d'inscription mardi 7 juillet 2009 Statut Membre Dernière intervention 3 novembre 2015 - 8 juil. 2009 à 12:06
nickydaquick Messages postés 416 Date d'inscription vendredi 31 janvier 2003 Statut Membre Dernière intervention 19 décembre 2013 - 15 juil. 2009 à 21:26
Bonjour,
J'ai un compte a rebours en as2 qui s'afficherait avant l'ouverture d'un site.
Le problème c'est que j'aimerais récupérer la date de fin du compte à
rebours par l'URL pour éviter de devoir rééditer mon .fla si la date
change...
Etant novice en as je n'ai aucune idée de la façon de procéder; on m'a parlé d'utilisé flashvars mais je ne connais pas cette fonction et google ne m'a pas aider a trouver une solution.
Quelqu'un peut-il m'aider?
voila le code:

stop();
currentDate = new Date();
thisYear = currentDate.getFullYear();
eventDate = new Date(thisYear, 6, 9, -1, 0, 0);
eventMillisecs = eventDate.getTime();
counter.onEnterFrame = function ()
{
    this;
    currentDate = new Date();
    currentMillisecs = currentDate.getTime();
    this.msecs = eventMillisecs - currentMillisecs;
    if (this.msecs <= 0)
    {
        play();
    }
    else
    {
        this.secs = Math.floor(this.msecs / 1000);
        this.mins = Math.floor(this.secs / 60);
        this.hours = Math.floor(this.mins / 60);
        this.days = Math.floor(this.hours / 24);
        this.msecs = String(this.msecs % 1000);
        this.secs = String(this.secs % 60);
        this.mins = String(this.mins % 60);
        this.hours = String(this.hours % 24);
        this.days = String(this.days);
        while (this.msecs.length < 3)
        {
            this.msecs = "0" + this.msecs;
        }

        if (this.secs.length < 2)
        {
            this.secs = "0" + this.secs;
        }

        if (this.mins.length < 2)
        {
            this.mins = "0" + this.mins;
        }

        if (this.hours.length < 2)
        {
            this.hours = "0" + this.hours;
        }

        while (this.days.length < 3)
        {
            this.days = "0" + this.days;
        }

        for (movie in this)
        {
            if (this[movie]._parent == this)
            {
                this[movie].evaluateFrameFrom(this);
            }

        }

    }

    __reg1 = undefined;
}
;
MovieClip.prototype.evaluateFrameFrom = function (variableClip)
{
    var __reg1 = this._name.split("_");
    var __reg3 = variableClip[__reg1[0]];
    var character = Number(__reg1[1]);
    var __reg2 = 1 + Number(__reg3.charAt(character));
    if (this._currentframe != __reg2)
    {
        this.gotoAndStop(__reg2);
    }

    __reg3 = undefined;
}
;

Merci d'avance.

2 réponses

ChasseurDeChimeres Messages postés 292 Date d'inscription mercredi 7 novembre 2007 Statut Membre Dernière intervention 15 janvier 2013 3
8 juil. 2009 à 12:53
  Salut;
En effet le flashvar peut être une bonne solution, il te suffit d'intégrer ton swf avec swfobject (par défaut avec l'option "publier" de flash) et de rajouter tes variable en paramêtres.
Tu devras transformer ta page html en page php et rajouter dans le code d'intégration :








so.addVariable("date_du_jour", "<?php print date(); ?>");


bonne continuation






( http://wiki.mediabox.fr/documentation/swfobject )
0
nickydaquick Messages postés 416 Date d'inscription vendredi 31 janvier 2003 Statut Membre Dernière intervention 19 décembre 2013 3
15 juil. 2009 à 21:26
salut,

verifies du cote de ExternalInterface;

tu recuperes l'url avec ExternalInterface.call("window.location.toString") , ensuite tu peux faire ce que tu veux;


salut, et bonne continuation.

http://liveplayaz.com
je suis heureux de faire partie d'une grande famille ...!
/B&
0
Rejoignez-nous