A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: One button to load different movies

  1. #1
    Junior Member
    Join Date
    Sep 2002
    Posts
    23

    One button to load different movies

    I want to have 1 Next Button and 1 Previous Button in my movie. I want the next button to load movieB if movieA present, movieC if movieB is present and so on. The reverse should be true for the Previous Button. Can I do this with actionscript with only 2 buttons and 10 movies?

    thanks,

    Powersolo
    thanks a million!

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Yes if the movies are named sequentially.Something like this....
    First have .......
    i=0;
    ...on the first frame.

    //Next
    on(release){
    i++;
    loadMovieNum("movie"+i+".swf");
    }

    //Prev
    on(release){
    i--;
    loadMovieNum("movie"+i+".swf");
    }

    If you have other buttons that load movies you have to add the i variable to them also. For intsnce if you loaded movie3.swf with a button, the code on that button should have this added to it

    i=3;

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Junior Member
    Join Date
    Sep 2002
    Posts
    23
    Thanks!

    I'll give that a try. Just to make sure....

    Do I add a frame action - "set variable", i as the varialble and 0 as the value, in the the first frame of the main movie, or movie with the button? Does that make sense?

    thanks for all your help,

    Powersolo
    thanks a million!

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    First frame of the movie.

    If you use expert mode you can just paste the code in the actions panel.

    There is something wrong with the code, I forgot to tell which level to load into so the code should be.

    //Next
    on(release){
    i++;
    loadMovieNum("movie"+i+".swf",1);
    }

    //Prev
    on(release){
    i--;
    loadMovieNum("movie"+i+".swf",1);
    }


    That will make the external swf's load into _level1
    You can also load into target movieclips ( easier to positions). But start with this.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

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