A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: next, prev. buttons !! Help plz

Hybrid View

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    3

    next, prev. buttons !! Help plz

    Hi,
    I have a series of images (01.jpg, 02.jpg, 03.jpg, .....)
    and i want t load the pic. with next and prev. buttons, next to load the next picture and prev. to load the prev. one, but it's too much pictures so i want it to be dynamic and at the end of the pictures to disable the next button and at the first picture to disable the prev. button. something like picture gallery

    thanks in advance
    cheers

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    1,017
    put them in array
    and save a var on the side, if the ver is first or ladt disable the buttons
    mey the swartz be with you

    http://www.amirlotan.com

  3. #3
    Junior Member
    Join Date
    Oct 2003
    Posts
    3
    thanks for ur reply
    but I dont know how to do it

  4. #4
    Member
    Join Date
    May 2000
    Posts
    50
    any help about this ?
    i have the same problem i guess

  5. #5
    Junior Member
    Join Date
    Jan 2002
    Posts
    16

    Script for you

    Hi,
    I hope the below code gives the answer for your requirement.
    Given below are the guidelines for the script to work.

    1. Place the code on the first frame of the main time frame.
    2. name the images as "01.jpg","02.jpg" etc and keep them in the same folder where the swf resides...
    3. Name the movie clip instances as below
    Image Holder - imgHolder
    Back Button - prevButton
    Next Button - nextButton
    4. Change the value totalNoofImages based on the Number of Images you are using.

    This can be defined as a component also. just try that and let me know how it works.

    ----------------------------------------------------------------------
    currentImgNo = 1;
    totalNoofImages = 4;
    prevButton.enabled = false;
    imgHolder.loadMovie("01.jpg");
    prevButton.onRelease = function() {
    nextButton.enabled = true;
    currentImgNo--;
    loadImage();
    if (currentImgNo == 1) {
    prevButton.enabled = false;
    }
    };
    nextButton.onRelease = function() {
    prevButton.enabled = true;

    currentImgNo++;
    loadImage();
    if (currentImgNo == totalNoofImages) {
    this.enabled = false;
    }
    };
    function loadImage() {
    if (currentImgNo<9) {
    currentImgString = "0"+currentImgNo;
    } else {
    currentImgString = currentImgNo;
    }
    currentUrl = currentImgString+".jpg";
    imgHolder.loadMovie(currentUrl);
    }

    stop();
    ----------------------------------------------------------------------
    Fun is the best way to
    learn.

    Shan

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