[GastForen Archiv Adobe Flash & ActionScript [Flash 8] - SlideShow

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste
Archiv - Archivierte Foren
Themen
Beiträge
Moderatoren
Letzter Beitrag

[Flash 8] - SlideShow

ssh
Beiträge gesamt: 37

19. Dez 2006, 17:11
Beitrag # 1 von 3
Bewertung:
(1488 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Leute,

ich habe hier eine kleine SlideShow http://www.acioo.com/...eshow/slideshow.html

Gibt es die Möglichkeit das sich die Flashdatei die Bilder zufällig aus einem Ordner holt? Denn Momentan habe ich das Problem, dass Flash die Bilder immer nur in der Reihenfolge wie sie in der XML-Datei angegeben ist abspielt.

Vielleicht kennt jemand ein Script das nicht allzu kompliziert ist …

Viele Grüße Sam.


Code
  1. MovieClip.prototype.alpha = function (vel, to)
    {
    var _loc1 = this;
    _loc1.vel = vel;
    _loc1.to = to;
    _loc1.alpha_init = _loc1._alpha;
    _loc1.onEnterFrame = function ()
    {
    var _loc1 = this;
    updateAfterEvent();
    if (_loc1.to != undefined && _loc1.vel != undefined)
    {
    if (_loc1.to > _loc1.alpha_init)
    {
    if (_loc1._alpha <= 100)
    {
    _loc1._alpha = _loc1._alpha + _loc1.vel;
    }
    else
    {
    _loc1.onEnterFrame = null;
    } // end else if
    }
    else if (_loc1._alpha > _loc1.to)
    {
    _loc1._alpha = _loc1._alpha - _loc1.vel;
    }
    else
    {
    _loc1.onEnterFrame = null;
    } // end else if
    return;
    } // end if
    };
    };
    function parse(success)
    {
    var _loc3 = this;
    if (success)
    {
    imageArray = new Array();
    var root = _loc3.firstChild;
    _global.numPause = Number(_loc3.firstChild.attributes.timer * 1000);
    _global.order = _loc3.firstChild.attributes.order;
    _global.looping = _loc3.firstChild.attributes.looping;
    _global.fadetime = Number(_loc3.firstChild.attributes.fadetime);
    var _loc1 = root.lastChild;
    for (var _loc2 = 0; _loc1.nodeName != null; ++_loc2)
    {
    imageData = new Object();
    imageData.path = _loc1.attributes.path;
    imageArray[_loc2] = imageData;
    _loc1 = _loc1.previousSibling;
    } // end of for
    imageArray.reverse();
    imageGen(imageArray);
    return;
    } // end if
    } // End of the function
    function swapPlace(clip, num)
    {
    eval(clip).swapDepths(eval("loader" + num + "_mc"));
    } // End of the function
    function loadImages(data, num)
    {
    if (i == undefined || i == 2)
    {
    i = 2;
    createLoader(i, data, num);
    i = 1;
    }
    else if (i == 1)
    {
    createLoader(i, data, num);
    i = 2;
    } // end else if
    } // End of the function
    function createLoader(i, data, num)
    {
    thisLoader = eval("loader" + i + "_mc");
    thisLoader._alpha = 0;
    thisLoader.loadMovie(data[num].path);
    watcher_mc.onEnterFrame = function ()
    {
    var _loc2 = thisLoader.getBytesLoaded();
    var _loc1 = thisLoader.getBytesTotal();
    if (isNaN(_loc1) || _loc1 < 4)
    {
    return;
    } // end if
    if (_loc2 / _loc1 >= 1)
    {
    swapPlace("loader2_mc", 1);
    thisLoader.alpha(_global.fadeTime, 100);
    timerInterval = setInterval(imageGen, _global.numPause, data);
    delete this.onEnterFrame;
    } // end if
    };
    } // End of the function
    function imageGen(data)
    {
    var _loc1 = data;
    var _loc2 = _global;
    if (_loc2.order == "random")
    {
    while (randomNum == randomNumLast)
    {
    randomNum = Math.floor(Math.random() * _loc1.length);
    } // end while
    loadImages(_loc1, randomNum);
    randomNumLast = randomNum;
    }
    else if (_loc2.order == "sequential")
    {
    if (p == undefined || p == _loc1.length && _loc2.looping == "yes")
    {
    p = 0;

    } // end if
    loadImages(_loc1, p);
    ++p;

    } // end else if
    clearInterval(timerInterval);
    } // End of the function
    Stage.scaleMode = "noScale";
    Stage.align = "LT";
    var randomNum = 0;
    var randomNumLast = 0;
    this.createEmptyMovieClip("loader1_mc", 2, {_x: 0, _y: 0});
    this.createEmptyMovieClip("loader2_mc", 1, {_x: 0, _y: 0});
    this.createEmptyMovieClip("watcher_mc", 100);
    images_xml = new XML();
    images_xml.ignoreWhite = true;
    images_xml.onLoad = parse;
    images_xml.load("images.xml");
    stop ();

X

[Flash 8] - SlideShow

ganesh
Beiträge gesamt: 1981

20. Dez 2006, 15:16
Beitrag # 2 von 3
Beitrag ID: #267815
Bewertung:
(1473 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Ja. Entweder du erstellst das XML serverseitig via PHP, oder änderst innerhalb von Flash die Reihenfolge der Bilder.

Letztlich läuft es darauf hinaus, dass du irgendwann einen Array hast, und diesen durchschütteln musst, um die Reihenfolge zu ändern.

PHP:
http://ch2.php.net/...function.shuffle.php

AS:
http://www.sephiroth.it/proto_detail.php?id=149


als Antwort auf: [#267644]

[Flash 8] - SlideShow

ssh
Beiträge gesamt: 37

20. Dez 2006, 15:26
Beitrag # 3 von 3
Beitrag ID: #267822
Bewertung:
(1470 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Danke für die Antwort! Es läuft mittlerweile.


als Antwort auf: [#267815]