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.randomduplicateMovieClipI 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?
Adobe > ActionScript 1 and 2
Posted on: 12/20/2006 09:04:40 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Movie Clips In Fixed Location But In A Random Position
When my movie loads I want my 6 movie clips (same shape different size) to be randomly located within a contained area (see dashed line box in attached movie). I would like their vertical centres to be randomly located with this area but there to be even space between each movie clip.
In other words each time the movie loads each movie clip would be in a different (random) position.
Can anyone help?
Thanks
Newtoo
Random Location
hi guys,
I am making the following movieclip
several buttons and a plane which flies above a map.
I want to following to happen
I click on button 1 and the plane goes to location 1
I click on 2 and the plane goes tol ocation 2
I click on 3 and the plabe goes to....yes to location 3
I click on 4 and the plane goes to location 4
I click on 5 and the plane goes to location 5
etc..
it's easy to make if the user will use the buttons from 1- 5. Unfortunately this is not going to happen...the user will go from 1-3-2-1-4-3-5 or something.
But I want the plane to fly to the correct location...from every point
Unfortunately I have NO clue on how to start...I downloaded MX trial version now ( i have Flash5 experience, but i am not a good programmer)
Can somebody help me on the way?
Thnx!
Joris
PS. if somebody has a wordl map that is vector based and is willing to share it with me....please let me know, still looking for it
Random Location
how do you make a movie clip appears at random location and time?
Moving A MC To A Random Location
two questions actually....
1st...On a mouse over...I want a movie clip to move to a random location on the stage.
2nd...somewhat related...I want to be able to click...anywhere on the stage...and the movie clip goes there.
I know how to do this with "easing"....but I want the movie clip to follow a path...not a straight line.
In other words...if I had a maze....and I clicked somewhere in the maze....the movie clip would follow the maze to the location.
Too much to ask?
Any help would be appreaciated!
Thanks!
Random Location, But Not Overlapping?
I have a game that scatters letters around the stage and users have to use the arrow keys to move something around grabbing the letters in order.
This all works just dandy, but sometimes the letters over lap.
Is it possible to have them scattered randomly, but then move a bit more if they are touching another MC? Or just not stop if they are touching another MC?
I also want to build in some obstacles in the future and don't want the letters overlapping the walls and what not. I could prevent them from landing on the outer walls, but not things in the middle.
Moving A MC To A Random Location
I want to move a Movie clip....to a random location on the stage...based on when a user does a mouse over on the Movie clip.
In other words.....if I had a little box...in a movie clip...sitting on the main stage...and you mouse over it...I want it to "slide" to another location...but I want it to be totally random...
What type of code do I use?
Any suggestions would be appreaciated.
Thanks,
Mark
Moving A MC To A Random Location
I want to move a Movie clip....to a random location on the stage...based on when a user does a mouse over on the Movie clip.
In other words.....if I had a little box...in a movie clip...sitting on the main stage...and you mouse over it...I want it to "slide" to another location...but I want it to be totally random...
What type of code do I use?
Any suggestions would be appreaciated.
Thanks,
Mark
Random Movie Clips To Play For Random Amount Of Time
hi,
i am loading external movieclips randomly into 4 seperate emptymovies, i now need a way to get these random clips that i am loading to play for a random amount of time and then load the next clip.
i need some help with the code...
how do i get the clips to loop, then assign each a random number and have flash check if the random num is = to current frame...if it is, have that clip stop and a new one load?
i have no idea how to write the code for this
any help would be great
thanks
this is what i was given so far..but don't know what to do with it.
Code:
var rnd = Math.round(Math.random(mc._totalframes));
mc.onEnterFrame = function() {
this._currentframe >= this._parent.rnd ? unloadMovie(this) : null;
}
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
Help: Multipule Random Positioned Duplicate Random Movie
Does anyone know a way that i can produce a button that when rolled over will duplicate x amount of movies each with random _x and _y positions? Basically i have a movieclip that will
gotoandPlay(math.Round((math.Random()*10)+1)
which randomises that frame that is played. This instance will then do some form of tweening and then gotoandPlay(1) again. I need a script that will then keep generating more duplicate movie clips whilst a button is moused over. i tried the following
on(mouseover){
i = 0;
rand_num = math.Round((math.Random()*29)+1);
while(i<20) {
duplicateMovieClip(_root.movie, "movie"+i,i);
setProperty("movie"+i, _x, _root.movie._x+(rand_num*5);
setProperty("movie"+i, _y, _root.movie._y+(rand_num*5);
i++
}
}
where movie = movieclip name
but this seems to generate all the clips on top of each other @ different depths. I want movies that are all in different positions. Can you help?
Move To A Random Target Location
hi!! i'm using flash five and i need some help with making the following happen.
a movie clips actions:
loop
pick a random number with math.random for x
pick a random number with math.random for y
loop:
head towards x and y one pixel at a time
until -> has reached x and y, then
loop
please excuse my crappy psuedo code, hope someone can help!
Problem Generating Mc In Random Location
I made a button with the following actionscript:
on (release) {
amount = 50;
while (amount > 0) {
duplicateMovieClip(_root.box, "box"+i, i);
setProperty ("box"+i, _x, random(275));
setProperty ("box"+i, _y, random(275));
setProperty ("box"+i, _xscale, random(50));
setProperty ("box"+i, _yscale, random(50));
i++;
amount--;
}
}
The point was so that when you clicked on the button it would randomly generate a movie clip of a falling box, in random locations and sizes. This code is pulled directly from flash's reference guide. I'm not sure what I'm doing wrong, but the clip is not generating.
Random Movies That Change Location
I'm trying to create a movie effect. I would like the movie to appear at a location then appear at a different location then appear at another location. Can anyone help? My code is:
this.attachMovie("movie1", "newMovie", 1);
this._X = 10;
this._Y = 10;
this.attachMovie("movie1", "newMovie", 1);
this._X = 20;
this._Y = 20;
Load Mc Into Random Stage Location
Hello,
I want to load a movie clip into a random location on a stage that is 1024 x 768... yes a screen saver... but I am not sure how to go about specifying random stage placement..... Can anyone help me out?
Thanks ahead of time for your help... JK
Load Mc Into Random Stage Location
Hello,
I want to load a movie clip into a random location on a stage that is 1024 x 768... yes a screen saver... but I am not sure how to go about specifying random stage placement..... Can anyone help me out?
Thanks ahead of time for your help... JK
MC Duplicate With Random Location In Set Range
Hey all!
Im having a bit of a problem with duplicating a movieclip.
Im an AS noobie, so dont kill me for stupid mistakes lol.
Heres what im trying to do:
I have a button, when the <Insert> key is pressed and if the variable money at root is higher or equal, then make the variable "vpill" equals 1 and duplicate the MC "pill".
Heres the code i have for that:
Code:
on (keyPress "<Insert>"){
if (_root.money >= 1000){
_root.vpill = 1;
_root.money -= 1000;
duplicateMovieClip(_root.pill, "pill"+1, _root.pill);
}
}
As for the MC "pill", what i want is if the variable "vpill" equals 1 then at a random location (in a set range), place the mc, and if hitTest is true with "player" then _root.speed -= 1; make "vpill" equal 0 and remove the duplicated MC.
Heres the code i have on "pill" MC:
Code:
onClipEvent (load) {
randomNum=function(Minimum,Maximum){
return Minimum+Math.random()*(Maximum-Minimum);
}
if (_root.vpill == 1) {
pillx = randomNum(220, 480);
pilly = randomNum(70, 330);
this._x = pillx;
this._y = pilly;
if (this, hitTest(_root.player)) {
_root.speed -= 1;
this.removeMovieClip();
_root.vpill == 0;
}
}
}
NOTE: Variables are all placed in the root.
Thx in advance!
If u dont understand something, feel free to ask. THX!
Have Random Motion But Ending At A Set Location?
Hi-
Say you have no more than (7) instances of a movie clip about to come on stage. Randomly changing the opacity, scale, and speed of each shouldnt be a problem right? There's plenty of info out there on how to do that.
BUT, how do you get the instances to move randomly (and er, differently) each time the sequence loads, but have them end (or "land") on the exact same spot each time?
ie - move around where ever you want for such-and-such specific amount of frames (or time), but make sure you stop right HERE when you get to the pre-determined end of the sequence.
Thoughts?
Load Mc Into Random Stage Location
Hello,
I want to load a movie clip into a random location on a stage that is 1024 x 768... yes a screen saver... but I am not sure how to go about specifying random stage placement..... Can anyone help me out?
Thanks ahead of time for your help... JK
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.
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
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
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
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!
|