A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Photo gallery

  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

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Unlock the timer layer, and click ONCE on the slideshow autoplay button, and then press F9 to open Actions Panel - in there, type this:

    Actionscript Code:
    onClipEvent(load){
        gotoAndPlay("loop");
    }

    then, enter the autoplay movieclip, and click on the frame with the label loop, open Actions panel by pressing F9, and copy and paste this in there:

    Actionscript Code:
    play();

    Hope it helps, and you need to upgrade to AS2 or AS3
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    24
    Hey Nig13

    many thanks for that, that works great!


  4. #4
    Junior Member
    Join Date
    Jul 2009
    Posts
    24
    Hey Nig 13

    one more little thought with it, at the moment the 'Photo placeholder' is the thing that animates, zooms in & out, is there an easy way to get it to be the photos that zoom in and out rather than the grey box(Photo Placeholder)

    thanks for your help!

  5. #5
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    That'd be very difficult, so I advice you to keep the current one
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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