A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Photo gallery

Threaded View

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    24

    Photo gallery

    Hi All

    would someone be able to help with this script I have. its for a photo gallery that I downlowded, the images fades in and out, but only start that when you click a button(timer)

    I'm trying to founf out where in the script I can change this, so that the photo's start automatically, rather than, on a button click.

    I have pasted the script below, is that ok, or would people rather a zip file of the files?

    I have also attached demo files

    many thanks for any help!




    // (c) Copyright by Andrew DiFiore. All rights reserved. DO NOT REMOVE.
    fscommand("allowscale", "false");
    Stage.scaleMode = "noScale";

    targetPhoto._visible = false;

    slides_xml = new XML();
    slides_xml.onLoad = loadSlideShow;
    slides_xml.load("album.xml");
    slides_xml.ignoreWhite = true;

    function loadSlideShow(success) {
    if (success == true) {
    rootNode = slides_xml.firstChild;
    totalSlides = rootNode.childNodes.length;
    currentSlideNode = rootNode.firstChild;
    photos = new Array(totalSlides);
    thumbs = new Array(totalSlides);
    captions = new Array(totalSlides);
    tx = 0;
    for (i=0; i < totalSlides; i++) { // populate arrays and create thumbnails dynamically
    photos[i] = currentSlideNode.attributes.jpegURL;
    thumbs[i] = [currentSlideNode.attributes.jpegWidth,currentSlide Node.attributes.jpegHeight];
    captions[i] = currentSlideNode.firstChild.nodeValue;
    _root.attachMovie("thumb","thumb"+i,i);
    _root["thumb"+i]._x = tx;
    _root["thumb"+i]._y = 595; // using fixed Y coord
    _root["thumb"+i].tindex = i;
    tx += 22;
    currentSlideNode = currentSlideNode.nextSibling;
    }
    // initialize values
    currentIndex = 0;
    targetWidth=thumbs[currentIndex][0]; // get width
    targetHeight=thumbs[currentIndex][1]; // get height;
    updateSlide();
    }
    }

    function updateSlide() { // load photo, update caption and status fields
    targetPhoto.loadPhoto(photos[currentIndex]);
    caption = captions[currentIndex];
    statusField = (currentIndex+1) + "/" + totalSlides;
    }

    function slideShow() {
    if (currentIndex == totalSlides-1) { currentIndex = 0; } else { currentIndex++; }
    targetPhoto._visible = false;
    targetWidth=thumbs[currentIndex][0]; // get width
    targetHeight=thumbs[currentIndex][1]; // get height;
    updateSlide();
    }

    MovieClip.prototype.loadPhoto = function(fn) { // load external jpeg method + preloader
    this.createEmptyMovieClip("holder", 1);
    this.holder.loadMovie(fn);
    this.onEnterFrame = function() { // NOTE: could use this to display percentage to user
    if (Math.floor((this.holder.getBytesLoaded()/this.holder.getBytesTotal())*100) >= 100) {
    delete this.onEnterFrame;
    }
    }
    }

    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center