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




Random Movieclip Help?



hey guys this be an easy one for ya, i have 4 mc in the library, the mc are a character in different clothings. i want to be able to put a random so each time you log into my site the character is different. Probably want to attach the random character to an empty movieclip (container), so the postioning be the same, any ideas how i would code this???? cheers



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 09-08-2007, 11:50 AM


View Complete Forum Thread with Replies

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

Random Movieclip @ A Random Partly Defined Position
Ok I´ve searched this forum to death but i didn´t REALLY
find the answer to my question! I think it can´t be that
difficult but i´m new to action-script and so i gotta hope
u´ll know the answer :

I´ve got an movie. (uh yeah ^^) in this movie there are
many movieclips that contain animations. now i want these
mcs to appear randomly @ a random position of a few defined
positions.

I really got NO idea how to do this !*prayinforyahelp*

ok thx 8]

Movieclip Showen In Random Places At Random Time
How can I make my movieclip appeare in diffirent places at diffirent time? And the movie clip is this flying mobilephones(you can see it in swf http://www.hot.ee/at03/flying-mobs.swf).

Thanx in advance!

Flash 8 Random Sound, Random Movieclip
Dear people, happy greetings to you all.

I would like to find some way of using a simple variable structure to do 2 things:
Pick and play a random sound from say - a selection of 5 sound files.
Do something similar with movieclips.

If you could show me where some relevant tutorials are that show how to do this or can supply some indicative code I would be most grateful.

many thanks
julie
*

Random Sound, Random Movieclip,
Dear people, happy greetings to you all.

I would like to find some way of using a simple variable structure to do 2 things:
Pick and play a random sound from say - a selection of 5 sound files.
Do something similar with movieclips.

If someone could point me in the direction of any tutorials that show how to do this or can post some indicative code I would be most grateful.

Thanks in advance.

julie
x

Random Movieclip?
i haven't used flash for almost 2 years now...now i work on it again and i forgot everything.

how do you make a movieclip that plays randomly in time? it doesn't have to move btw. i'm using flash 5.

thanks in advance for your help.

Random Movieclip Help?
hey guys this be an easy one for ya, i have 4 mc in the library, the mc are a character in different clothings. i want to be able to put a random so each time you log into my site the character is different. Probably want to attach the random character to an empty movieclip (container), so the postioning be the same, any ideas how i would code this????



cheers

Random Movieclip
How do you make it so that flash will load a random movieclip?

Random Movieclip
i have an animation and some movie clips. i want to add my scene an action that brings movieclips from my library randomly on my stage in every 20 seconds. how can i do that?

the movieclips should be on the stage so we can see them but they should be invisible until they called from the action.

Random Movieclip
Anybody have a tutorial or know anything about random movieclips. I want my movieclips to apear randomly.


Please help!!!

Random Color To A Movieclip
i want to change the color of a movieclip randomaly
but i want to change only the red. the blue and green have to be the same all the time.
that's the way i do it
do you have a simple way?
tell me.

on (release){
mycolor=new color(mc);
p=random(256)
// convert to hexa
nb=new number(p);
p=nb.toString(16);
p= "0x" add p add "00" add "00";
p=parseInt(d);
mycolor.setRGB(p);
}

Help With Random Falling Movieclip
I'm trying to make a simple game in Flash, but i'm stuck already...
I want to make diffrent objects (movieclips) fall randomly from the "sky" (like old arcad games)
What i know, the best way to do this is to create an array, or am i wrong?
Is there some simple way to do this?
It would be really nice if someone could explain how i should do or what i should search for in this board (probably this has been asked before)

thx

Random Movieclip Selection
Hi,

I'm working on a game in which men will be running out of a house (the user will be grabbing the men and dropping them back into the house), but...I suck.

I'd like to have 10 assorted "men" (movie clips), and have flash randomly decide which "man" to play on stage. That would be fairly simply, except that I want many of these guys onstage at any given time (so I can't just have flash randomly choose between keyframes, each of which has 1 different guy onstage). And I've found code for creating random movements of snowflakes and things like that, which I suppose I could use except that I want all these "men" to have the same point of origin onstage and then run (randomly) offstage from there.

Can anyone help me figure this out? I hope this post makes sense.

Thanks, you people rock.

Random Movieclip Actionscript
Hello, I have 3 movie clips inside of a flash movie. I want to radomly display a different one each time the page is loaded. So the script would be on the first frame and the 3 movie clips on the following 3 frames. I've done this before and forgot what the script was and i lost my source file! Please Help!!!

Random Movieclip Actionscript
Hello, I have 3 movie clips inside of a flash movie. I want to radomly display a different one each time the page is loaded. So the script would be on the first frame and the 3 movie clips on the following 3 frames. I've done this before and forgot what the script was and i lost my source file! Please Help!!!

Play Random MovieClip...
Hi there, I've got this movie which contains 10 mc's and at the moment I'm getting them to run sequentially..... however I would like to be able to randomize where the sequence starts up so that it's not always the first mc that is played when someone views it...
ie. 1,2,3,4,5,6,7,8,9,10 repeat,
or 3,4,5,6,7,8,9,10,1,2 repeat
or 7,8,9,10,1,2,3,4,5,6 repeat etc......

at the end of each movie (eg movie 5)I've got the code:

_root.movie6.gotoAndPlay("start"); etc

but it's just the random one to begin with that I'm having trouble with

Any ideas will be greatly appreciated

Cheers

Random MovieClip Creator
Hello, I am making a doger game. And I can do everything from making the speed vars to doing the hitTests but of course, the most important thing I donno how to do. How do I make the flash movie create a movieclip in random (random X, same Y (top of screen)), and then have them fall at the random speed?

Selecting A Random Movieclip
Ok,
I need to sellect a random movieclip on the stage and then store its name in a variable '_root.randomname', the prob is that there are no set names for the movieclips on the stage (the name could be anything) and there is no set amount of them - there could be 1, or 100 movieclips, so how do i select a random one and store its name in the variable?

Regards,

Random Alpha On MovieClip
I have this code on a MC to make it's _alpha appear randomly:

Code:
onClipEvent (load) {
this._alpha = 0;
}
onClipEvent (enterFrame) {
if (this._alpha<100) {
this._alpha = random(50);
}
}
The MC "flickers" , but I'm attempting to make the random alpha "FADE" from one alpha level to the next so that the alpha appears more softly....

Pop Up Random Movieclip On Stage
Im currently making a kind of flashmovie for a youth festival next year.
The problem is that it is a bit boring (http://www.teejay.no/lab/ferdig.html) (Yes it is in Norwegian, click "Ja" to enter the movie!)
To make it a bit more interesting and fun for the viewers, I came up with the idea of making lots of movieclips, each containing a person's "profile", where you can read about a person, and choose wheter to read more, or ignore this person. These movieclips should pop up on the stage once every minute or so, and randomly.
Does anyone have any suggestion on how I could possibly accomplish such effect?
In short; I need some kind of a script to randomly pick out a movieclip and place it in front of all other elements once every minute or so.

Appreciate all help! Excuse my English.

TeeJay

Random Symbols In Movieclip
Hey guys,

I'm putting together a little flash movie for my company's website which will display all of our clients' logos in a sort of grid fashion. What I'd like to do is create a single symbol/movieclip which will act as a container for each logo (see image below), and each time the symbol/movieclip is on the stage, it displays a random logo (which are individual symbols) in it.



What's the best way to do this?

Thanks in advance.

Random Text In Movieclip
Hi,

i have created 3 movieclips, which each hold a rectangle.
Here is what i need to be done:

Everytime the movie loads, i need to have a random text in each of the rectangles. Lets say i have 20 different text pieces. And everytime the movie loads, Flash has to pick 3 text pieces which will be placed in the 3 rectangles.

How is this done?

I hope you understand... Otherwise let me know and i will do my best to explain it furthermore.

thanks in advance!

Jump To Random Movieclip
Hi, I'm sure it's a really simple thing, but I can't get it done.

I want several movieclips to play in random order after each other. At the end of mc1 it jumps to a random movieclip and so on. Not stopping, just playing mc after mc.

Thanks for all your help!

Random Movieclip Loader
Alright so I'll just get down to it. I have created 2 different movie clips in my flash file that I've given an instance name of "clip1" and "clip2". I'm trying to have them load in the blank "mcHolder" movieclip I've created and placed into scene1. I have one frame on Scene1 and 4 primary layers that are in this order:

1) actions layer
2) mcHolder mask (888px X 257px) set to view layer as an outline
2) mcHolder layer
3) background layer

I have stop(); at the end of both individual movie clips so they will stop. What I am ultimately trying to achieve is have the two different clips load randomly when the web page is loaded with the embedded .swf file in the webpage. Each time the page refreshes, the flash banner loads its random clip (even though there are only two). Appreciate an help!



Chris

Random Movieclip Onrelease
Hi There,

I'm having some trouble with making a random movie clip display properly when I click on my button. Here is the code that works when I release.

on (release) {
num = Math.round(Math.random()*2+1);
groupa = _root.attachMovie(["groupa"+num], "groupa", _root.getNextHighestDepth());
groupa._x = 300;
groupa._y = 200;
}

This works but the only thing is the movie clip goes to to the front of the stage. Is there any way to set it to the back of the stage?

Also, I'd like to unload any other movie clips that had been previously loaded once clicked.

Random Movieclip Frame
Hello all,

I am trying to write some code that when a movie clip is clicked, it chooses a random frame to go to within the movieclip. My problem is making sure that the same frame cant be selected one after the other (which in results in having to click again). My code is as follows:


PHP Code:



on (press) {

previousnum = randomnumber;
randomnumber = Number(random(3)+2);

trace("Previous - " + previousnum);
trace("Random - " + randomnumber);

if (previousnum == randomnumber) {
this.gotoAndStop(2);

} else {
this.gotoAndStop(randomnumber);
}} 




With this code, the random works, though it is not checking to see if the number has been picked allready.

Any idea's?

Random MovieClip On Click
When I click a button I need a random movie clip to appear they are called test, test2, test3.

I'm pretty sure I need an array. I have a container movieclip to hold the clips but how do I ranomly bring them to stage. I can bring just one to stage using the linkage how do I bring the others.

My code so far:


ActionScript Code:
var container_mc:MovieClip;
var container_mc2:MovieClip;

function showCard(event:MouseEvent):void
{
    container_mc = new test;
    addChild(container_mc);
    container_mc.x = 270;
    container_mc.y = 135;
}
button.addEventListener(MouseEvent.CLICK, showCard);

function hideCard(event:MouseEvent):void
{
    container_mc2 = new test;
    addChild(container_mc2);
    removeChild(container_mc);
    container_mc2.gotoAndPlay("down");
    container_mc2.x = 270;
    container_mc2.y = 135;
}
button2.addEventListener(MouseEvent.CLICK, hideCard);

Load Random MovieClip
I have 10 MovieClips and I want to Load those MovieClips Randomly to my stage, but there is One Condition each MovieClip have to be Played just Once.


Anyone Have an Idea how can I do that.

Thanx for Help

Load MovieClip At Random, But Only Once
Ok, this is the case:

I've got 12 MovieClips with the following linkage identifiernames:

"lbrboven", "ldrboven", "lflboven", "lfrboven", "lgeboven", "lgrboven", "lliboven", "lnhboven", "lovboven", "lutboven", "lzeboven" and "lzhboven".

I want them to appear on screen AT RANDOM. But each MC has to appear just one time. If all 12 have appeared (each time you start the application, the appearance is in a different order), the appearance have to stop and the application has to go to another frame.

How do I need to this?

Someone told me to use attachmovie method and using arrays. Something with this:

clips = ["MC1", "MC2", "MC3" ... "MC12"]

randMC = clips.splice(random(clips.length),1);

if (clips.length){
randMC = clips.splice(random(clips.length),1);
}


Can someone help me with this and give me the exact script for this?

Thanks in forward!

Random Movieclip Problem
Ok I tried searching and i cant seem to find what im looking for


I have 2 movie clips on stage, and im trying to play a random one, but for some reason my last line of code doesnt work. Can someone please tell me what im doing wrong.

i = Math.round(Math.random()*2);
newTarget = "Target" + i;
trace(newtarget);
newTarget.play();

HELP Random MovieClip Behaviour
One of the movieClips on my stage keeps dissapearing when i run the fla. Flash is still registering it (i can trace out its co-ordinates, alpha, visible, width, height etc.) but it's not visible on the screen and other movieClips wont interact with it. Iv'e checked its at top of visible area etc. and from all i can tell it should be visible but its not.
The movieClip is using a class file i wrote which was working before.
Basically what happened is it was all working, there was as on the first frame referring to the movieClip. I accidently added a keyframe to the wrong layer (the layer with the mc on, so the mc was no longer present in the first frame). I compiled and tested and i saw what i had done, i presumed it was just becaues the mc was no longer present on the first frame. I undid the changes and now it continues not to work. I've made no other changes and it's really weird. plz help!

EDIT: OK i did some more testing and its as if its no longer registering it's class file, when i try and trace out any of the class variables i just get returned undefined. I still can't figure out whats causing it.

Help With Random Movieclip Timing...
Good with Graphics terrible with action script...can anyone help?

How can I play a movie clip at random intervals?

I have a simple movie clip of a glint that I placed on the main timeline.
I want the glint to animate at random intervals of less than 20 seconds.

Not sure how to script it with the random function...

Any help would be great..

Random Movieclip Generation
I'd like to know how to randomize the animation of 10 individual movieclips that are pulling in a .jpg image each.

I've looked all over and found how to randomize the same movie clip, but how do I take my 10 clips....have random animation as they enter the frame, then stop?

The clips are mc_1 thru mc_10 and all use the loadmovie for the individual .jpg images. The .jpg images work currently, but I have to go into animate them when I want them different on multiple pages. I just want to randomize everything.

Please help!!!!

THANK YOU in ADVANCE.

Please, Help Me... Random Play For Movieclip
Hi, I need help for this,

how can play a MovieClip in a random delay or at random time in my main scene? need an actionscript? anybody can help me?

in advance, thankful

koamis

Loading Random Swf Into Movieclip
ok, let me start by saying I'm very new to AS3, and little confused as its sooooo different to AS2. So please go easy :-) I used to be able to do everything in Flash MX so easy now with new CS3, I feel like a retard!

Ok, All I am trying to load a bunch of random swf's into a movieclip. This is an example of what I would have used in the past with AS2. What would I do now for AS3.

filename = ["1.swf", "2.swf", "3.swf"];
path = http://www.domain.com/swfs/banners;
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], placerMC);

Any hints?

Random Movieclip Postition
How do i make it so the moviclip loads at a random X when tween starts.(but keeping it inside the stage)
This is my origanl code.

Code:
mport mx.transitions.Tween;
import mx.transitions.easing.*;

var mc_arr = [image1,image2,image3,image4,image5];
var counter = 0;

function tweenIn(target_mc:MovieClip){

var image1_a:Tween = new Tween(target_mc, "_alpha", Regular.easeIn, 0, 100, .5, true);
image1_a.onMotionFinished = function() {
setTimeout(tweenBack,100,target_mc);
};
}

function tweenBack(target_mc:MovieClip){

var image1_ab:Tween = new Tween(target_mc, "_alpha", Regular.easeIn, 100, 0, .1, true);
image1_ab.onMotionFinished = function(){
counter = (counter < mc_arr.length-1) ? counter+1 : 0;
tweenIn(mc_arr[counter]);
};
}
tweenIn(mc_arr[counter]);

Choosing A Random Movieclip
Hello,

I'm trying to achieve the following:

On my stage are 8 movieclip, respectively called squid1 to squid8. I'm trying to make actionscript designate one of these 'actors' at random once in a while, and make it pop up/do something. Dont know what exactly yet. Here's what I'm working on...


Code:
function chooseActor() {
var pickNumber = (Math.floor((Math.random()*8)));
var result:Object = new Object();
result.chosenSquid = "squid"+pickNumber;
result.chosen = pickNumber;
return result;
}

function popUp() {
var result:Object = chooseActor();
var chosenSquid:MovieClip = result.chosenSquid
var chosenNumber = result.chosen

trace(chosenSquid);
trace(chosenNumber);

_root.chosenSquid._alpha = 50

}

popUp();
Now chooseActor funtion does what I intend it to do, i.e. generate a variable consisting of the word 'squid' combined with a number. I expected I could simply use this variable as the name of a movieclip and then just unleash all sorts of wackiness on it. But it doesnt work.

Am I thinking stupid again?

kind thanks,
Vandenberg

Help With Random MovieClip Loader?
Hi Guy's, Gal's and Other's...My question is I want to load a different movie clip's when the site load...

When the site fist loads

Code:
_root.mc_EmptyTrunk.loadMovie("./Flash/mc_Trunk.swf");
stop();
Trunk loads then from the trunk

Code:
_root.mc_EmptyLogo.loadMovie("./Flash/mc_Logo.swf");
stop();
The Logo loads

I want to load a random clip in before it loads the Logo...
say 7 or 8 different clips into "_root.mc_EmptyRandom"
how do i even start this?

Thanx,
Babalou

Attach Random Movieclip?
Hi.

Say I have four different movieclips. "Car1", "Car2", "Car3" and "Car4".
Now I have an empty mc that I want these fifferent movie clips attached to on an (enterFrame) handler. How can I do it? Believe me, I have tried! I have never used the word "random" before yesterday. I get the "Car"-mc´s to change colors randomly every time they start, but...Please try and help me become a Flash princess...Please...

Random Movies In An Empty Movieclip?
I've been up for 4 hours trying to figure this out...trying to figure out code i've found here on somewhere else on the Internet....and I just can't get this working.

I have my movie with an empty movieclip in it. I have 2 .swf files in the same directory as the main movie.

What I want to do is have one of those 2 .swf files randomly load inside the movieclip...each and every time the main flash movie is loaded.

I also want to be able to know how to expand this script if I create more movies in the future that I want to randomly insert.

All I'm able to do right now is use the loadMovie action to load a specific movie into the empty movieclip. The randomizing is a mystery to me

Movieclip With Random Colour And Y Position
i'm creating a screensaver where a line of text containg four words will scroll from right to left. i like to know how to do the following:

1. the text should change its 'y' position randomly for each scroll
2. when the text changes its 'y' position for the next scroll should also apply four different specific colour to the specific word in the text
3. the next scrolling text should appear just before the previous one leaves the screen.....i.e. when the previous one is sticking out a couple of inches....

Random Movieclip Placement...BUT With Restrictions
Hiya, I've read quite a few of the existing posts but nothing seems to match my problem so this a last resort....

I'm creating a basic drag and drop exercise so basically i have lots of different movieclips which need to be placed in the correct spot, however, to make this less predictable I'd like to postion the movieclips in a new spot everytime the exercise is loaded.

This seems pretty easy enough using Math.random and size limitations according to size of my movie BUT i have the actual workspace onto which these movieclips have to be dragged is smack bang in the middle of the stage. SO my question is.... how can i place the movieclips on the stage randomnly each time the exercise is started up BUT not be positioned on the actual workspace??

I hope that makes sense

SWF/movieclip Random Timed Slideshow
Basically I need help creating a slideshow that loads .swf or movieclip files, randomly and for a small period of time (i.e. 10-15 seconds) then changes. Also be able to have back and forward buttons. You can e-mail me at nabilkazerouni@yahoo.com

Random Stop, Looping, MovieClip
I have a movie clip with 20 unique sequential frames that is set to loop (all numerals). Is there a way that I can make this movieClip timeline head begin to play and loop (at the click of a button) with it quickly decelerating to stop on a random frame (kind of like a Wheel of Fortune thing"?

Thanks in advance for any assistance!

Help Loading A Random Movieclip Or Graphic
I was wondering if there's any possible way with flash to be able to random put a graphic on a page each time that page is visited.

i.e. (a different photo is viewable to a visitor) for let's say 8 different photos.

Thanks.

Pick Random Swf And Load To Movieclip
Hey dudes.

I have this script on a frame which loads .swfs into clips:
Code:
stop();

_root.whatLoad = "middle";
mtClipLeft_mc.loadMovie("homepageLeft.swf","homepageLeft");
mtClipRight_mc.loadMovie("homepageRight.swf","homepageRight");
Except I would like to change the homepageLeft.swf bit into a random bit.

What I mean is:

I will make a folder called homepageleft and inside this folder I will have .swfs called "homepageLeft01.swf", "homepageLeft02.swf" etc.

I want the above script to be able to pick a random number based on the number of possible .swfs there are to choose from (say 5) and then add that number to the end of "homepageLeft" and then add ".swf" onto the end... does that make sense / is that possible? Thanks for any help.

Peace


edit. just re-read and it doesnt make a great deal of sense huh?

to clarify.

I want movies to load on the left hand side of my homepage. This works fine so far as i only have one movie "homepageLeft.swf". Groovy.

The next step is to have a selection of possible movies to load and to pick a random one and load that. They will all be the same dimesions but rather large - hence the separate movies (each will have a preloader built in).

Thanks again for any help

[F8] Moving A Movieclip In A Random 360° Angle
I want a movieclip to move in a random direction continuously from a certain point. I am going to use this script in a loop to create an effect.

Generating Random Occurences Of Movieclip
hi there.

i've always been more of a score-based animator, but due to some really strict file-size limits on some work I am doing, I need to learn quickly how to generate things randomly (ie snow, glitter, etc)

Can anyone tell me how this can be done with a limited but working understanding knowledge of actionscript? Maybe tweak an existing movie.

Thanks for any input!

Steve

[MX2004] Random Movieclip Loading
I have searched the forum, and found many topics on what i need, but none seem to work.

I have 4 MC's and i need the flash file to choose a random clip, play it, then choose another clip, play it etc

I tried the following technique, but it glitches i.e. the MC will play for a split second then play the next. (MC's are 10 seconds long)

Layer 1, Frame 1 - Actionscript:

function go(){
gotoAndStop(int(Math.random() * 4) + 1);
}
setInterval(go,10000);

Then i have Layer 2, Frame 2, 3, 4, 5 holding a MC each.

Someone posted this technique on the forum, and I replicated as best i could understand, yet it does not work for me.

Any insights are welcome,

Thanks

EDIT :: I found some Actionscript that worked, by putting all my MC's into one big MC. The problem I face now is that because the clips laod randomly, i get repeats. How can I combat this? Something like MC1, MC4, MC1 would be ok but MC1, MC4, MC2, M1 would be nicer (less repetition) Thanks once again!

[F8] Movieclip Rotation, Random Directions
Hello,

I am currently trying to make a butterfly move in random directions. The movement is easy, but making the butterfly face the direction he's flying is killing me. So far i have:


Code:
onClipEvent (load) {
//data you may want to change
width = 300;
height = 200;
speed = Math.round(Math.random()*2)+1;
//initial positions
x = this._x=Math.random()*width;
y = this._y=Math.random()*height;
x_new = Math.random()*width;
y_new = Math.random()*height;
}
onClipEvent (enterFrame) {
//x movement
if (x_new>this._x) {
sign_x = 1;
} else {
sign_x = -1;
}
dx = Math.abs(x_new-this._x);
if ((dx>speed) || (dx<-speed)) {
this._x += sign_x*speed;
} else {
x_new = Math.random()*width;
}
//y movement
if (y_new>this._y) {
sign_y = 1;
} else {
sign_y = -1;
}
dy = Math.abs(y_new-this._y);
if ((dy>speed) || (dy<-speed)) {
this._y += sign_y*speed;
} else {
y_new = Math.random()*height;
}
}
Its moving, its just not turning. I have been googleing all day please help me

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