Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Loading Random Movie Clip:



I want to load a random movie clip from the library to an empty clip on the stage called (bg_graphics). the clips in the library are called (green, blue, yellow). How do i go about doing this? any help would be great.CheersPeter.D



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-20-2004, 02:06 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Loading A Random Movie Clip?
I have a movieclip that contains 4 other movie clips.
I want the container movie clip to play one of the 4 other movie clips at random.

I have given the four movie clips instance names.

tracer0 through to tracer3. but im not sure where to start.

any help/tutorials would be greatly appreciated.

thx

M@D

Loading Random Movie Clip
I am trying to load a random movie clip (within a specified movie clip set) - however cannot find any documentation on this. Has anyone done this before and can help me out? Thank you. - MIKE

[F8] Loading A Random Movie Clip
Hello all,
welcome to my post. i am trying to find some AS to have a random movie loaded for a website. a different one each time you visit. is this even possible in flash? i have been googleing every term i can think of related to this but cant find any AS to do it. i have been stuck on this for over a week. some help would be appreciated.

Thanks,
3zekial

Random Movie Clip Loading
I am making a survey which consists of 50 questions in which each question will play one movie clip and will ask the user to enter in a text box what they think about it. After that they click next and will go to the next clip. How can I make it so it selects the clips randomly without selecting a previously viewed one?

Random Movie Clip Loading
I am making a survey which consists of 50 questions in which each question will play one movie clip and will ask the user to enter in a text box what they think about it. After that they click next and will go to the next clip. How can I make it so it selects the clips randomly without selecting a previously viewed one?

Loading Random Movie Clip:
I want to load a random movie clip from the library to an empty clip on the stage called (bg_graphics). the clips in the library are called (green, blue, yellow). How do i go about doing this?

any help would be great.
Cheers
Peter.D

Help Loading A Random Frame For A Movie Clip
the main movie is 5 frames. i have a movie clip on every frame of the main movie. this movie clip is the background for the main movie. i want this movie clip to go to a random frame every time you go to one of the frames.

now i was able to have this movie clip go to a random frame when loaded by making a blank frame at the beginning of the movie clip with this code


Quote:




goToAndStop(random(4)+2);




but when i went to a different frame on the main movie the movie clip would just stay on that frame. i need the movie clip to go to a random frame every time one of the main movies frames load. the purpose of this is to have a random background every time a frame on the main movie is loaded.
can anyone help me with this. thanks.

Loading A Random Movie Clip From An Arry
hello everyone:

I am a newbie, and I'm sure this is an easy one. How do I load a movie clip randomly from an array? Do I need to use a container movie clip to load them into? I've tried a few methods that work for external swf's - but I want to load movie clips that are already in my library.

thanks

Loading Random (externa) Images In A Movie Clip
hey i just want my movie clip to load random images in a frame

so in frame one it shows image2
in the next frame it shows image15
in the next frame it shows image7 and so on.....

all the images are in the library, they cant be loaded externally as its going to be used for an advert on a site somewheree


any ideas??????

thanks

ps im a newbie :-(

Movie Clip Tween From A Random Point To Another Movie Clip?
ok...
on a website I am trying to make...i have a rotating E (lowercase)

it flips around and does all kindsa crap

but when a person clicks on a button, i want it to tween from whatever frame it is on, to where all 3 of them line up and do a little flashy type thing

ei:
e#1 - upside down and backwards
e#2 - sideways and rotating on the y axis
e#3 - rotating on the x axis

now i want all of these to tween from the point they are at to a specific order....so they are all flat (ei: they look like this "e")

how the heck do i do this?!? i know i have seen it somewhere!!

Remove Movie Clip And Attach Random Movie Clip
Hi: I am trying to create a mini game where there are pods of equations in which players must solve in order to make the pod disappear. Once a pod disappear a new one appears.

Attached is my .fla file so far- but I have been having trouble trying to remove movie clips once the player has solved the equation, and then attaching a random movie clip in the same location. I've been trying to use an if then statement but I'm not really sure? I also placed a removemovieclip at the end of a movieclip. I'm fairly new to actionscript.

So if anyone can help me with that I would really appreciate it. I am looking to finish this project in the next day or two!!

Thanks in advance.

Random Location For A Random Movie Clip
I have various movie clips which I need to appear in one of four locations randomly. I need the movie clip to also be random. I also need more than one movie clip on stage at the same time. I believe the following needs to be used:

Math.random
duplicateMovieClip

I also believ that the method needs to be generic. Apart from that I am stuck.

Any help/ideas are appreciated.

Hope my question makes sense?

Loading More Than One Random Clip?
Heres the deal. I've found tutorials that show how to randomly load from a selection of movie clips. My problem is, I have two clips that load on top of each other. Ones a blurred image, the other is a clear, and when you move a mask over the image, it goes from blurry to clear. Right?

But I want a different image to load everytime. Problem is that I need both the random blurry and clear pictures to be the same! No point moving your mouse over a blurred picture of a mountain only to find a clear river underneath, right?

Loading More Than One Random Clip?
Heres the deal. I've found tutorials that show how to randomly load from a selection of movie clips. My problem is, I have two clips that load on top of each other. Ones a blurred image, the other is a clear, and when you move a mask over the image, it goes from blurry to clear. Right?

But I want a different image to load everytime. Problem is that I need both the random blurry and clear pictures to be the same! No point moving your mouse over a blurred picture of a mountain only to find a clear river underneath, right?

Random Clip Loading And Preloading Question
Hi everyone I hope someone can help me with an interesting problem I am having. I have searched the forums for an answer but I cant find anything that exactly applies to the situation I have.

I am trying to load / preload external movie clips here is the scenario:

Main movie grabs and preloads a random clip from a selection of 10 external clips.

Whilst the first clip is playing another random clip has to be selected and be preloading in the background whilst the first clip plays.

The first clip loops until the second clip is ready to play.

The process continues randonly playing clips without replaying a previously played clip. Once all clips have been played the process starts again.

The problem really lies in not repeating previously played clips and preloading the selected clips in the background.

Does anyone have any ideas?
All help and sudgestions are greatly appreaciated!
Thanks

Loading External Movie Clip With A Button Inside Another Movie Clip Help
Hi,

I am working on a scrolling thumbnail movie clip, that when you click on the thumbnail button inside the movie clip it will load an external movie clip. I have an empty movie clip on the main stage, and have been trying all sorts of code, but for some reason it doesn't like that I am inside a movie clip using buttons. It can't seem to find the external swf.

I have tried:

on (release) {
loadMovie (ithink.swf, "loader");

and

on (release) }
if (firstTime == true) {
loadMovie("ithink.swf", _root.loader);
firstTime = false;
} else {
_root.clicked = "ithink.swf";
_root.loader.gotoAndPlay("goback");
}
}

and so far nothing, for some reaosn when I click on a button outside of the movie clip with the above code it loads... and than the other works too, but if I click on the buttons inside the scolling movie clip first they won't work.

Any suggests or ideas!!?

I would really appreciate it... I am beyond frusterated!!

Flash Beginers: Loading A Movie Clip Into Another Movie Clip
I just need a simple way to load a movie clip into another holder movie clip based on a mouse event. PLEASE HELP, i know it's easier than it must seem.

Random Movie Clip
Alright, I still can't get this to work properly. In my main movie, I am trying to call random movie clips to be played within my main movie whenever it reaches certain keyframes. This is probably something extremely simple, but those are usaully the hardest ones for me to figure out.

Random Movie Clip
How can I randomly load a movie clip on loading a swf? The movie clips are inside the swf.

Random Movie Clip
I'm using Flash MX

I would like to know if there is a way I can randomly trigger a movie clip to play? I have created a simple movie clip which is then positioned a number of times in the same scene and on the same frame but I want each of these movie clips to be able to play individually from each other and randomly. Is this possible?

Random In A Movie Clip
when you put have a random engine within a movie clip, and the movie clip has multiple instances on the stage, will each clip have the same random number, or should they all be different?

I am trying to have multiple instances of a movie clip fade in at different times, and different rates, each to a different final alpha level. Here is the script I am using, but they are all fading in uniformly.

(all actionscript is inside the MC)
<b>Frame 1;</b>
this._alpha=0;
count=0;

<b>Frame 2;</b>
count=count+1;
trans=(Math.random(30))+60;
if(this._alpha<trans&&count>=Math.random(2000)){
newAlpha=this._alpha+(Math.random(20));
} else if(this._alpha>trans) {
newAlpha=trans;
}
this._alpha=newAlpha;

<b>Frame 3;</b>
gotoAndPlay(2);


Help please!

Thanks

Random Movie Clip?
I'm making my site and I want to make it so that a random movie clip place in one part of the movie. Or make it so that one big movie clip plays random parts of itself, in a loop. How do I do this? Please keep in mind that I know practically NOTHING in actionscript.

Random Movie Clip,
hey im using flash 5 and tryin to make a bomb fall from the sky, i want one bomb to fall from the top of the page to the bottem, then after i want it to pick a random point on the x axis and do the same thing again but on a differnt line on the x axis,

the code i am using is

bomdvar = random (570);
_root.bomb_godown._x = bombvar;

the syntex says its right but it dosent change the place it falls, it just repeats in the same line.

any help would be good!!!!

Random Movie Clip Appear
I have seen this done on many websites, but I just cannot figure out the code, I have five movie clips. Everytime a used enters the site I would like them to see one of the five. How do I set it so that onEnterScreen a random movie clip from the five appears? I asumme I will be able to position each in the same area with this code.

Random Movie Clip Help
I need movie clips to play one after the other in a random order.
I have no idea in actionscript. Please help!
Nataly

Random Movie Clip
How to do that this:

http://img396.imageshack.us/img396/8734/25vk4.png



I want that the number will be random, on button click (this is the hit by the sword)
How do i do it? Numbers less than 35 etc.

Random Movie Clip Help
Hi! I want to create an underwater scene with bubbles. I have created a movie clip called "bubble". How do I make that movie clip randomly appear and then diappear at different positions in my movie? Also, is it possible to make the bubble randomly appear in more than 1 place at a time? Thanks for the help!

Random Movie Clip
Hi,

I am a newbie so can some pros help.

I am trying to get a movieclip to move around the stage to a random positon each time. Then i want it to leave a trail.
Please could some pro help me with corrections!

Heres the code

Code:


import flash.filters.*;
import com.mosesSupposes.fuse.*;
import com.leebrimelow.utils.*

this.createEmptyMovieClip("leader", 1);

var xleader = leader.x;
var yleader = leader.y;

var xandy = xleader + yleader;

//Filters

var dropshadow:DropShadowFilter = new DropShadowFilter(10, 30, 0x666666, 3, 3, 3, 3, 3, false, false, false);
var glow:GlowFilter = new GlowFilter(0x333333, 2, 5, 5, 3, 3, false, false);

leader.filters = [dropshadow,glow]

//End of filters

if (i=0;i<=xandy;i++) {
   
   new f:Fuse = new Fuse();
   f.push({target:leader, x:grp, y:grp, controlX:grp, controlY:grp, time:2});
   f.start();
   
}

else {
   
   new f:Fuse = new Fuse() {
      
      f.push({target:leader, x:grp, y:grp, controlX:grp, controlY:grp, time:2})
      f.start();
      
   }
   
}

function grp(); {
   
   return math.round(math.random() * 400);
   
}



Thanks

Harry

Random Bouncing Movie Clip?
I am trying to devise an effect where a movie clip would randomly bounce around in a box (like looking from above) Like a "breakout game". The only thing is I need the ball to slow down when it is about to hit a wall and then slowly speed back up when it leaves a wall. Anyone got any ideas? Thanks

Random Movie Clip Placement
Can anyone help me, I want to make 3 movie clips appear randomly and of various sizes on the screen, it is for a shooting game that I am developing at the moment.

Thanks in advance
Josh

HELP - Random Movie Clip Load
I have a problem. I am trying to get a movie to load a random swf file each time run. The files are 1.swf, 2.swf, 3.swf, ect..... Here is the script I am trying.

ran = random;
loadMovie (load.swf ="brands/(ran).swf", "load");

What the hell am I doing wrong?

Thanks for your help,
Bryan

Random Playing Of Movie Clip Help Pls
Hi all. I have a question about how to randomly play a movie clip. Here is what am trying to do. I have a background that looks like a circut board. I want an electric pulse to run on a guide and follow one of the lines in the board. The MC works fine except I would like the pulse to be random. I think it just looping looks stupid. Please any help would be greatly appreciated.
Thanks for reading.
Tom

Random Movie Clip Placement - Possible Bug?
I have NO idea why this doesn't work...I've rewritten it every possible way with the same results...all the movie clips are created, but not placed properly. The movie consists of one movieclip on the main timeline called "circle". There is one frame in the main timeline with the following actions:


Code:
for (i=1; i<=10; i++) {
duplicateMovieClip ("circle", ["circle"+i], i);
with ("circle"+i) {
this._x = Math.random()*_root._width;
this._y = Math.random()*_root._height;
}
}
stop();


When the code is run, all circle clips are placed in the same spot instead of randomly. A few trace actions show me that despite the main timeline having dimensions of 550x400, the height is being detected as 80. The random numbers are being correctly generated from the wrong dimensions. I've also tried the code without using WITH as such:

Code:
for (i=1; i<=10; i++) {
duplicateMovieClip ("circle", ["circle"+i], i);
["circle"+i]._x = Math.random()*_root._width;
["circle"+i]._y = Math.random()*_root._height;

}
stop();



Exact same results with this method. Anyway, this was supposed to be a test for something much more difficult, but I'm stuck on this easy part and starting to think I've forgotten how to ActionScript. Please help.
[Edited by minorgod on 12-25-2001 at 06:09 PM]

Playing A Random Movie Clip
Is there a way to go to and play a random frame or load a random movie clip.

What I am trying to do is place the actions on a button so on release it will choose a random movie clip and play it.
could I do this using an array?

please help I have a deadline.

Random Starting Movie Clip
Hi everyone, I guess this is a newbie question, not sure about that...so here's my little problem:

I have got this movie clip in my flash movie that is to start at random times over and over again, actually it's a bubble animation, bubbles running up the movie. To make it look more "natural" the movie clip of each bubble should start playing at random times.
My problem ist that I don't know too much actionscripting except the usual "on mouse - play - stop" :-/

So if anybody could help me out on how to create randomizers and using them to start movie clips I would be glad, I've been browsing the tutorials-section for hours but didn't find anything equivalent.

Thanks in advance, folks

Stopping A Random Movie Clip
I have a first person shooter I'm building. I need some help on the below code.


onClipEvent (enterFrame) {
_x = random(380)+60;
}
on (press) {
this.gotoAndPlay(2);
_root.score += (10);
}



The code works great as far as the positioning of the clip. But it cuts on and off real fast. Not the desired effect. I want it to pick it's random spot stop until shot and then go somewhere else.

Suggestions


Thanks

Random Movie Clip Positioning
hello

i'd like to place a movie clip in a random position on a 600 x 100 stage, then once it's played it's 60 frames, move it to another random position... loop forever.

any ideas?

Random Movie Clip Frame
Hi all!

How can I get a movie clip to 'onLoad' gotoAndStop on a random frame number?....I have 10 frames within the movieclip each with different picture on....just want random pic to load each visit.

cheers

Andy

Movie Clip Random Fade
I'm using Flash MX

Put simply, I have a background image on a layer which then has another layer on top filled with 100x100 square movie clip instances (of the same movie clip symbol). The movie clip symbol fades out and then back in again over a period of 5 seconds. What I would like to achieve is to have the movie clips randomly fading in and out, rather than me create a large secondary movie clip where I 'fake' the random fades over a large loop.

Hope that makes sense.

Random Movie Clip Fade
I'm using Flash MX

I would like to know if there is a way I can randomly trigger a movie clip to play? I have created a simple movie clip which is then positioned a number of times in the same scene and on the same frame but I want each of these movie clips to be able to play individually from each other and randomly. Is this possible?

Random Movie Clip Play
I put a bunch of movie clip symbols on my flash movie. Using actionscript, how do I get them to play at random times? It doesn't matter if they play at the same time.

Random Frame In Movie Clip
Hello,

Can someone please tell me how to play a random frame of a movie clip?

I am trying to make a movie clip that has a different sound on each frame of it, and when you press a button it will play a random sound each time.

Thanks for your help, much appreciated!

Cheers,
Mike

Random Movie Clip Generator
Hi I'm new to Actionscript and am making a simple game based on the film Donnie Darko.

The game concept is based on whack-a-mole, with characters coming out of holes which the user has to click to score points.

- I have three character movie clips (frank, francine and jim).
- I also have a static movie clip (rabbitHole).
- The character movie clips reside inside the rabbitHole clip.

The characters all have tweened animation which makes them pop out of and back into the hole.

I want it so that the character clips play at random from within the rabbitHole clip. To specify, only one character can come out of the rabbitHole clip at any one time.

I have been experimenting with the Math.random function to little avail. Preferrably I would like the jim movie clip to play at much more infrequent intervals, as he is worth more points in the game, thus he should not appear on the screen as regularly as the other two clips (frank and francine).

Any help/guidance would be much appreciated.
Thanks!

Play Random Movie Clip
Hello,

I'm trying to set up an aquarium type flash movie. I want to have it play random movie clips but never more than two at the same time. So far all I've been able to do is have a couple loooong loops running that over lap. I know there must be a way to detect if something is already playing and then if not play a movie. Another couple complications... 1. I want some of the movie clips to play more often than others. 2. The background transitions from one image to another and I don't want the random clips to play during the transition because it slows everything down. Any help would be greatly appreciated.


Aarg!

Play Random Movie Clip
Hello,

I'm trying to set up an aquarium type flash movie (in Flash 5). I want to have it play 3 sets of random movie clips (background, midground, foreground) but never more than two at the same time. Currently the main timeline is one frame long with layers for each of the above mentioned levels (BG, MG, FG). The items in each level are placed in a movie clip called "FG elements" etc. Within the "FG elements" movie clip are 6 frames holding 6 movie clips of different animations.

So what I was trying to do was first have each level check to see if more than one of the other levels was playing a movie clip. If not, that level would then pick a random frame to play. That's the theory but I have no idea what action scripting to use. Does this make sense? Is there an easier way?

Oh, and I also wanted to preload the various parts in the least noticable way so the playback is smooth. This will eventually be a screensaver not live.

template file attached if needed...

Any help would be greatly appreciated.


Aarg!

Display A Random Movie Clip HELP <<<<<<<
hi, i've got 7 movie clips in my flash file that i would like to play in a random order, how do i do this? right now i've just put them on the timeline right after another, but loading the page and always having the same order gets boring. also how do i make it so that it runs for an infinite amount of time (for example, it wont just order 1,6,5,7,2,3,4 then stop, but keep going 1,5,3,7,2,6,3,4,1,5,1,2, on and on) and is there a way so that it doesnt choose the same movie clip consectively? for example so that it doesnt choose 1, 7, 4, 4, 4, 2? dont use flash that often, so i really need help with this, thanks so much !!!!!

Preloading Only 1 Random Movie Clip?
Hi there,

My Flash(MX Pro 04) file needs to randomly load 1 of 5 different movie clips out of the library...

Now, I have the preloader on frame 1...

Also on frame 1 I have this code:

--------

pic = new Array("1", "2", "3", "4", "5");
_root.mcBlank.attachMovie(_root.pic[random(5)], pic1, 0);

--------

The problem is that Flash tries to preload ALL the movie clips. I don't want it to do this.

How do I get Flash to only preload the movieclip it randomly selects out of the library? At the moment, all 5 movie clips in the library have their linkage properties set to 'export in 1st frame'. If I don't do this, they don't seem to load in.

Any help would be great!

Random Movie Clip, What's Wrong Here?
I need to place a random room to the left of my character "man".
It worked when I used 1 room and specified its exact name, but now I'm trying to use a variable as the number of the room (hence the +pickroom bit - pickroom being my variable)
They are all named room1 room2 room3 etc.

here's what I got so far - this code does nothing at all as it is - Im missing something..?
code: if (moveman="left") {
set("_root.room"+pickroom._x, _root.Man._x-22);
set("_root.room"+pickroom._y, _root.Man._y-19);
set("_root.room"+pickroom._rotation, _root.Man._rotation+90);
gotoAndPlay(5);

It worked like this
code: _root.room._y, _root.Man._y-19
when I change it to be an expression it put the 'set' part, then doesnt work anymore, am bit confused.

Making A Random Movie Clip Appear.
A have a few movie clips and I only want one of those to appear in a certain place and have the other movie clips not to be visible, but to this to be chosen randomly.

Copyright © 2005-08 www.BigResource.com, All rights reserved