A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Playing random movie clips

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    2
    (sigh) It's been the better part of two days, and I still can't find the appropriate information on this. I'm doing a little movie that uses a button to display random movie clips I've made. There are twenty clips, and I'm not sure if I should be putting them all into separate frames in another clip, or putting them into separate frames in the main movie, or putting all the animation sequences into their own segments of a timeline. The syntax for randomizing the responses is eluding me too. I have found a number of tips on this sort of thing, but no single article seems to go all the way toward describing the process... Thanks in advance for your help, and my apologies if this question was answered elsewhere in the forum (I did check, but my head began to throb).

    Pete

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Posts
    107
    You sound like your are on the right path. I would do what you are saying and put the different movies in a movie clip on seperate frames and put stops on all the frames and then target(note. be sure to give the randomizing movie an instance name) the movie from the button on the main time line like so

    on (release) {
    tellTarget ("theinstancename") {
    gotoAndStop (random(20 + number (1)));
    }
    }


    Note: i put the + number(1) because I asume you would leave the first frame blank to start with and then it randomly goes to the frames 2 to 21 and be sure to set the goto action as an expresion.

    Good luck

  3. #3
    Junior Member
    Join Date
    Jun 2001
    Posts
    3

    couple of things...

    actually the random code you posted generates numbers between 1 and 20. random(20) would generate numbers 0-19. try this instead...

    Code:
    on (release) {
         _root.instanceName.gotoAndStop(random(20)+2);
    }
    this will generate numbers 2-21.

    on a side note...tellTarget is flash 4 syntax. it still works in flash 5, but i find the new dot syntax to be easier to write. anyway...


  4. #4
    Junior Member
    Join Date
    Jun 2001
    Posts
    2

    Smile

    Well, Bembino nailed it... Many thanks to Bembino and all who fired a neuron my way in an effort to help me out. Here's the finished product (posted on some wasted webspace until I sort out my main sites). Enjoy!

    http://www3.sympatico.ca/petopeto

  5. #5
    Junior Member
    Join Date
    Jun 2001
    Posts
    3
    cool...fun project!

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