IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ActionScript 1 & ActionScript 2 Discussion :

Help AS2 et XML


Sujet :

ActionScript 1 & ActionScript 2

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 2
    Par défaut Help AS2 et XML
    Bonjour à tous, voila je suis vraiment débutant en AS
    J'ai trouvez un tuto pour faire une galerie AS/XML
    je l'ai adapté pour qu'il convienne à ce que je recherche et le .swf fonctionne très bien mais quand j'importe ce swf dans un container sur ma page web plus d'images et plus de vignettes je ne comprends vraiment pas d'où vient le problème.
    le dossier images et le dossier vignettes sont au même plan que mes 2 .swf
    (le principal et la galerie)
    (paramètres de publication pour les 2 swf Player 9 AS 2.0)
    Quelqu'un pourrait il m'apporter ces lumières Merci d'avance !

    pour la scène principal voici le code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    containerGalerie.loadMovie("galerie.swf")
    et pour la galerie:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
     
    name_arr = new Array();
    date_arr = new Array();
    explain_arr = new Array();
    maGalerie = new XML();
    maGalerie.ignoreWhite = true;
    maGalerie.load("galerie.xml");
    maGalerie.onLoad = function ()
    {
        _global.numOfCon = maGalerie.firstChild.childNodes.length;
        for (var _loc3 = 0; _loc3 < numOfCon; ++_loc3)
        {
            node = this.firstChild.childNodes;
            name_arr[_loc3] = node[_loc3].childNodes[0].firstChild.nodeValue;
            date_arr[_loc3] = node[_loc3].childNodes[1].firstChild.nodeValue;
            explain_arr[_loc3] = node[_loc3].childNodes[2].firstChild.nodeValue;
            description.name_txt = name_arr[0];
            description.date_txt = date_arr[0];
            description.explain_txt = explain_arr[0];
        } // end of for
    };
    function init()
    {
        numOfBox = 30;//Total number of images show on movie
        thumb_holder._alpha = 0;
        outThumb._visible = false;
        moveX = -14;
        image_width = 45;//thumb box width
        image_spaceX = 5;//space between thumb images
        speed = 4.000000E-001;
        speed_thumb = 3.000000E-001;
        smooth.swapDepths(1900);
        right_btn.swapDepths(2000);
        left_btn.swapDepths(2001);
        _root.createEmptyMovieClip("group", 1000);
        group.setMask(thumb_holder);
        nextCount = 1;
        prevCount = 1;
        _global.imageNumber = 1;
    } // End of the function
    function moveBox()
    {
        for (var _loc3 = 1; _loc3 < numOfBox; ++_loc3)
        {
            group.attachMovie("outThumb", "outThumb" + _loc3, _loc3 + 100);
            thMc = group["outThumb" + _loc3];
            thMc._x = moveX + _loc3 * (image_width + image_spaceX);
            thMc._y = thumb_holder._y + 8;
            thMc.onRelease = function ()
            {
                description.name_txt = name_arr[Number(this._name.substr(8, 9)) - 1];
                description.date_txt = date_arr[Number(this._name.substr(8, 9)) - 1];
                description.explain_txt = explain_arr[Number(this._name.substr(8, 9)) - 1];
                _global.imageNumber = Number(this._name.substr(8, 9));
                loadBigImage();
            };
        } // end of for
        loadThumbs();
    } // End of the function
    function setupBtn()
    {
        left_btn.onRelease = function ()
        {
            prevCount = prevCount + 1;
            targetX = 50 - 50 * prevCount;
            if (prevCount < numOfBox - 15)
            {
                nextCount = prevCount;
                group.onEnterFrame = function ()
                {
                    this._x = this._x + speed_thumb * (targetX - this._x);
                };
            }
            else
            {
                delete group.onEnterFrame;
            } // end else if
        };
        right_btn.onRelease = function ()
        {
            nextCount = nextCount - 1;
            targetX = 50 - 50 * nextCount;
            if (nextCount >= 1)
            {
                prevCount = nextCount;
                group.onEnterFrame = function ()
                {
                    this._x = this._x + speed_thumb * (targetX - this._x);
                };
            }
            else
            {
                delete group.onEnterFrame;
            } // end else if
        };
    } // End of the function
    function loadThumbs()
    {
        var _loc2 = new MovieClipLoader();
        var _loc3 = new Object();
        _loc3.onLoadProgress = function (target, bytesLoaded, bytesTotal)
        {
        };
        _loc3.onLoadError = function (target_mc, errorCode, httpStatus)
        {
            target_mc._parent.noData.dataTxt = "VIDE";
        };
        _loc3.onLoadInit = function (target)
        {
            target._parent.noData._visible = false;
            target._parent.SPbar._visible = false;
            loadBigImage();
        };
        _loc2.addListener(_loc3);
        for (var _loc1 = 1; _loc1 < numOfBox; ++_loc1)
        {
            containerMC = group["outThumb" + _loc1];
            _loc2.loadClip("small/image" + _loc1 + ".jpg", containerMC.inThumb);
        } // end of for
    } // End of the function
    function loadBigImage()
    {
        var _loc2 = new MovieClipLoader();
        var _loc1 = new Object();
        _loc1.onLoadProgress = function (target, bytesLoaded, bytesTotal)
        {
            loadedBytes = bytesLoaded;
            totalBytes = bytesTotal;
            photo.percent_mc.percent = Math.floor(loadedBytes / totalBytes * 100) + "%";
            group["outThumb" + imageNumber].SPbar._visible = true;
            group["outThumb" + imageNumber].SPbar._alpha = 50;
            group["outThumb" + imageNumber].SPbar._yscale = Math.floor(loadedBytes / totalBytes * 100);
        };
        _loc1.onLoadError = function (target_mc, errorCode, httpStatus)
        {
            photo.percent_mc.percent = "VIDE";//displayed text when no data image
            description.name_txt = "";//displayed text when no data text 1
            description.date_txt = "";//displayed text when no data text 2
            description.explain_txt = "";//displayed text when no data text 3
        };
        _loc1.onLoadInit = function (target)
        {
            imageEffect();
        };
        _loc2.addListener(_loc1);
        _loc2.loadClip("large/image" + imageNumber + ".jpg", photo.inScr);
    } // End of the function
    function imageEffect()
    {
        photo.inScr._xscale = 10;
        photo.inScr._yscale = 10;
        photo.inScr._x = 150;
        photo.inScr._y = 150;
        bigImage = photo.inScr;
        this.onEnterFrame = function ()
        {
            bigImage._x = bigImage._x + speed * -bigImage._x;
            bigImage._y = bigImage._y + speed * -bigImage._y;
            bigImage._xscale = bigImage._xscale + speed * (100 - bigImage._xscale);
            bigImage._yscale = bigImage._yscale + speed * (100 - bigImage._yscale);
            if (bigImage._x <= 0)
            {
                this.onEnterFrame = null;
            } // end if
        };
    } // End of the function
    stop ();
    init();
    moveBox();
    setupBtn();

  2. #2
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 4
    Par défaut
    salut
    ton probleme viens de l'utilisation de _root
    quand tu charge un swf (anim1) dans un autre (principal) le _root de anim1 devient le _root de principal

    donc ton code fonctionne plus
    il faut eviter au maximum d'utiliser _root, il me semble que le seul vas ou tu peux utiliser _root est les flashvar, car de base elles sont definni sur _root

    donc soit tu modifie ton ciblage soit tu met un _lockroot = true sur la premiere frame de anim1, mais c'est mieux de pas utiliser _root

    a+

Discussions similaires

  1. flash 8 AS2 et XML
    Par Neeks dans le forum ActionScript 1 & ActionScript 2
    Réponses: 4
    Dernier message: 12/05/2009, 05h58
  2. flash CS3 / as2 / playliste xml mp3
    Par zonessai dans le forum ActionScript 1 & ActionScript 2
    Réponses: 5
    Dernier message: 22/04/2009, 12h38
  3. AS2 chargement xml et comparaison
    Par sitschner dans le forum ActionScript 1 & ActionScript 2
    Réponses: 0
    Dernier message: 02/04/2009, 15h19
  4. [FLASH MX2004] [AS2] XML
    Par aldo-tlse dans le forum ActionScript 1 & ActionScript 2
    Réponses: 1
    Dernier message: 27/08/2005, 21h20
  5. [AS2] Données XML et évènements
    Par scmilblick dans le forum ActionScript 1 & ActionScript 2
    Réponses: 15
    Dernier message: 26/07/2005, 16h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo