A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Controlling MC's over time

  1. #1
    Member
    Join Date
    Dec 2001
    Posts
    34

    Controlling MC's over time

    Hi,


    I'm trying to load 7 different movies into a container movie clip. The container movie has the load movie command on 7 seperate frames (each frame calling in its respective clip). How do i go about getting the movie to randomly go to each of these frames whith a delay of about 5mins before it moves onto the next frame.

    I'm sure it's something simple and any haelp would be greatly appreciated.

    Thanks,
    Barrie

  2. #2
    Standrard flasher
    Join Date
    Jul 2002
    Location
    Stockholm
    Posts
    342
    make a function that randomly selects a number 1-7 every 5 mins. this number is then set as a variable. then in the swf make an if statement, so that it goes to differnet frames depending on what the varibale is. it also has to check contiuosly that the variable hasn't changed. you don't really need differnt keyframes for every loaded swf, you can include them in the if statement.

  3. #3
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Code:
    frames_array = [1, 2, 3, 4, 5, 6, 7];
    gotoNextFrame = function () {
    	if (frames_array.length) {
    		randomFrame = Math.floor(Math.random() * frames_array.length);
    		gotoAndStop(randomFrame);
    		frames_array.splice(randomFrame, 1);
    	} else {
    		clearInterval(_interval);
    	}
    };
    _interval = setInterval(gotoNextFrame, 300000);

  4. #4
    Member
    Join Date
    Dec 2001
    Posts
    34
    Thats a great help. many thanks for the code. I should probably learn more about scripting instead of working on that blasted elastic band ball.

    Enjoy the rest of you day/evening,

    Barrie

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