Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
klick webforumsuser@macromedia.com #1
Random Movie clip play
I have 7 different MovieClips. I put them into the main MovieClip which is on the stage. I want the 7 clips to play randomly when the .swf is loaded. I also want to put a random delay before each MovieClip starts.
Any help is very much appreciated.
Thanks in advance.
Klick
klick webforumsuser@macromedia.com Guest
-
random movie play
Hi guys, I'm using flash 5 and I have a really simple question, how do I make a movie play randomly within my main movie. Once it's loaded the... -
play clip, remove clip, load new clip
I have an empty 'container' MC that has a MovieClip load into it when a button is pressed.....when another button is pressed, it should play the... -
Duplicate Movie Clip in a Duplicated Movie Clip...
I'm making a Flash Navigation Bar (menu) that could be freely customized by people just through a text file. The problem is that my submenus won't... -
Need help getting movie clip symbol to play
I'm trying to use a movie clip symbol on one of my scenes. I've created a new layer for it and dragged it onto the stage from my library, but it... -
PLAY (EXECUTE) AVI OR QT CLIP INTO STAGE OR EXTERNAL MOVIE PLAYER
HELLO To ALL Of the NG. I MUST "SIMPLY" MAKE TO EXECUTE (PLAYARE) A MOVIE CLIP QT Or AVI Or MPEG To the INSIDE Of the STAGE IN A FLASH MOVIE.... -
kglad webforumsuser@macromedia.com #2
Re: Random Movie clip play
you'll need to put the names of your movieclips into an array or choose their names cleverly. then do you want your movieclips to play one after the other (in random order)? do you want to allow repeats or do you want to them each to play only once? if they each play only once what happens after the last plays?
kglad webforumsuser@macromedia.com Guest
-
klick webforumsuser@macromedia.com #3
Re: Random Movie clip play
I need them to play in a random order they can double up if need be or just repeat after the seven have played. The other thing is can you put a random delay betwwen each movie clip playing? Thanks for the help.
klick webforumsuser@macromedia.com Guest
-
kglad webforumsuser@macromedia.com #4
Re: Random Movie clip play
mcA = new Array(); //put your movieclip names in here
for (i=0; i<mcA.length; i++) {
mcA._visible = 0;
mcA.stop();
}
playmc();
function playmc() {
clearInterval(restartI);
ind = Math.floor(Math.random()*7);
mcA[ind]._visible = 1;
mcA[ind].play();
checkI = setInterval(checkF, 100, ind);
}
function checkF(ind) {
if (mcA[ind]._currentFrame>=mcA[ind]._totalFrames) {
mcA[ind].stop();
mcA[ind]._visible = 0;
clearInterval(checkI);
restartI = setInterval(playmc, a*Math.random()+b);
// assign a and b to meet your needs
}
kglad webforumsuser@macromedia.com Guest
-
klick webforumsuser@macromedia.com #5
Re: Random Movie clip play
Thanks so much I have been tossing and turning with this problem.
klick webforumsuser@macromedia.com Guest
-
kglad webforumsuser@macromedia.com #6
Re: Random Movie clip play
you're welcome.
kglad webforumsuser@macromedia.com Guest
-
klick webforumsuser@macromedia.com #7
Re: Random Movie clip play
I apologize, I can't seem to get it to work. I'm not very good with arrays. The following is what I have. It is just basically what you gave me. How do I set up the Movie clips? Do I put your actionscript into scene 1 frame 1?
Thanks for all your help.
mcA = new Array();
//put your movieclip names in here
mcA = ["movie1", "movie2", "movie3", "movie4", "movie5", "movie6", "movie7"];
for (ivar=0; ivar<mcA.length; ivar++) {
mcA[ivar]._visible = 0;
mcA[ivar].stop();
}
playmc();
function playmc() {
clearInterval(restartI);
ind = Math.floor(Math.random()*7);
mcA[ind]._visible = 1;
mcA[ind].play();
checkI = setInterval(checkF, 100, ind);
}
function checkF(ind) {
if (mcA[ind]._currentFrame>=mcA[ind]._totalFrames) {
mcA[ind].stop();
mcA[ind]._visible = 0;
clearInterval(checkI);
restartI = setInterval(playmc, 2*Math.random()+1);
// assign a and b to meet your needs
}
}
klick webforumsuser@macromedia.com Guest
-
kglad webforumsuser@macromedia.com #8
Re: Random Movie clip play
putting your movieclip names in quotes is going to cause a problem. flash things those array elements are strings and not movieclip objects. you can either tell flash to resolve those strings into objects by using bracket notation or remove those quotes and inform flash that those names movie1,movie2 etc are objects. btw, setInterval operates on milliseconds. i doubt you want to restart a new movie between 1 and 2 milliseconds. a=1000 and b=2000 is more likely what you want.
kglad webforumsuser@macromedia.com Guest
-
klick webforumsuser@macromedia.com #9
Re: Random Movie clip play
You're not gonna belive this but I think I really did it, or I should say you did it! Thanks so much for the help.
Klick
klick webforumsuser@macromedia.com Guest
-
kglad webforumsuser@macromedia.com #10
Re: Random Movie clip play
congrats! and you're welcome.
kglad webforumsuser@macromedia.com Guest
-
Unregistered #11
Re: Random Movie clip play
i am using this code for another project and wasn't sure if you could help with another question... are you still answering questions
Unregistered Guest



Reply With Quote

