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




Random Background



I'm trying to design a custom tetris game for a local cricket club that I play for. I want to have a cricket background behind the main game. I want the background picture to change everytime the player starts a new game. How do I tell flash to load a new pic at the start of a new game????

Lee



FlashKit > Flash Help > Flash General Help
Posted on: 04-28-2003, 01:33 PM


View Complete Forum Thread with Replies

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

Random Background With Random Text File
I am trying to create a resizable flash file that will act as a background for my html/css website. Within the flash I want to have a script that randomly loads a jpg file from a specific folder on my server as well as a correlating txt file for that background. Here is an example of what I mean.

Say there is a movieclip named "background" and then a dynamic text area named "info" in the lower left-hand corner of the flash movie. I want a script to randomly load a jpg file (say 234.jpg) from a folder named "backgrounds" on the server. I also want it to load the correlating text file into the dynamic text area (234.txt) from a folder named "info". How would I do this and what would the script be?

NOTE: the names of the jpg and txt files would be 1.jpg, 1.txt, 2.jpg, 2.txt, etc.

Thank you for any help you can give!

-- K

Random Background
i have built a script to load a differenct background picture in random order. the script follows: -
SelectionBGArray = new Array();
SelectionBGArray[0] = "3";
SelectionBGArray[1] = "4";
SelectionBGTotal = SelectionBGArray.Length;
randomBG = SelectionBGArray[random(SelectionBGTotal)];
gotoAndStop (randomBG);

i have different background pictures on frame 3 and 4. the random function returns either 3 or 4 and thus gotoAndStop (3 or 4). i'm not very happy with this and it is very buggy. does anyone know better ways to do this? i would like to put all of the background pictures in one frame and manipulate the x and y coordinates as the .swf file loads. but i think setproperty method only works with on (release) event.

Random Background-mc's?
On my stage I have four buttons, and a background-mc too.

Let's say I want to have three background mc's, and want to random these mc's, so that they change every time I enter the site.

Is there a really easy way to do this? I'm using F4 and Mac.

Thanks ;D

coala

Random Background
I'm new here so...Hello!

I only really know the basics of Flash, I don't have much knowledge of Action Scripting but I'm keen to learn! So here goes with the first of many (probably very dumb) questions;

If I were to create say 5 different background graphics or images how would I go about being able to have one of them randomly load to the background of my flash page when somebody enters the site?

Hopefully it's nothing too difficult!

Thanks in advance,
Sarah.

Random Background
My client wants to use an image as the background but wants 3 different backgrounds that will be selected randomly at the time of loading. She is trying to avoid having the same background every time. Is this possible?

Random Background
hello.. i was just wondering the correct coding to use to create a randomized background.. im trying to find tutorials.. but no luck.. where the movie clip for the background is in one movie clip.. but i really didnt want it that the site would just be going through the same actual animation.. i wanted to change colour randomly from the ones i set.. and animate.. instead of just running the movie clip.. or making about 200 frames.. where once it gets to one from it stops.. then calls another.

thats actually the question im more so wanting to.. with actionscripting the code to make it count maybe a min or 2.. then go to a randomized frame label. hopefully this is possible. i havent actually touched flash for a while.. been pushed into using visual basic by my boss.. so ya.. if anyone can help.. im using flash mx 2004

Random Background
Fox,
i am very new to flash n need some urgent help,
working on a project where i need 2 things,

1. randomly changing background everytime i open that flash file
2. how to call an swf or a flash file in another flash file n play the animation with the background of the file in which i am calling the other fla.

e.g.
i want "movie X" to be played inside the "movie Y" with the background of the "movie y" and all the components too.

please help, a little urgent
thanks

Random Background
Im looking for a way of loading a random image from xml and resize it to 1280x960 . All the examples i have are for loading multiple thumbnails .

My xml is below , can anyone show me an example .


Quote:




<item type="Wallpaper">
<img><![CDATA[Wallpaper/name.jpg]]></img>
</item>

Random Background
For mostely all of you it's will appair as a stupid question but am searching for a soultion since couple houer whitout figure it


My problem is am trying at to load into my swf a random background each time a visitor come into the site. i read couple tutorial and put some idea from them tougeder.

I called my diferent background (in propriety panel) ''background1'' to ''background6'' and they are occurence of symbole 84 to symbole 89

so here my code


ActionScript Code:
//  random background donne une valeur aleatoire entre Background1,2,3,4,5 Nom d'occurence ActBg1,2,3,4,5

K = Math.ceil(Math.random()*5);
attachMovie("Background"+K, "ActBg"+K, 1);

                 
                 // displayit
                
"Background"+K = visible.root_;

am not sure of evrething in this code and am realy sorry to bother you whit that basic stuff Any kind of help would be appreciate thx

Random Background
Hi there
I was wondering how I can add a random background to my flash site. This script should generate a random background everytime someone views my site...

Exactly like this site: http://www.exopolis.com/site/
Visit it 2-3 times to see how it does it.

SWF Random Background
Hi,

Got a little problem that I hope all you talented Flash pros could help me with.



I’m creating a Flash site with a random, allow scale, swf background. On top of that background I want my navigation menu, this should not scale with the background.

I used the KIRUPA tutorial to create the random background and it works fine, the problem is that the top navigation menu doesn’t stay the same size….it scales with the background. Think I have to use Fscommand() somehow?



If you go to www.puma.com, you can see exactly what I’m looking for.



Here is the Kirupa tutorial: http://www.kirupa.com/developer/mx/loadingrandombackground.htm



Thanks!

Random Background
when i make this flash can find my images but can't open them:

Random Background From XML
hey guys, its been a while since ive been on here. but i need some help.

i am making a full screen flash site and need a random pic as the background but it loaded from an xml file so the client can control it.

i know you guys know how to do this im not looking for new code!!

thanks in advance this place is awesome

Random Background From XML
hey guys, maybe i posted this in the wrong place earlier.

i need help bad, in a bind and need a background of a full window flash movie to be a random image with data loaded from an xml file.

any code or tips you have will be greatly appreciated i need help!!

Random Background
Hi there
I was wondering how I can add a random background to my flash site. This script should generate a random background everytime someone views my site...

Exactly like this site: http://www.exopolis.com/site/
Visit it 2-3 times to see how it does it.

SWF Random Background
Hi,

Got a little problem that I hope all you talented Flash pros could help me with.



I’m creating a Flash site with a random, allow scale, swf background. On top of that background I want my navigation menu, this should not scale with the background.

I used the KIRUPA tutorial to create the random background and it works fine, the problem is that the top navigation menu doesn’t stay the same size….it scales with the background. Think I have to use Fscommand() somehow?



If you go to www.puma.com, you can see exactly what I’m looking for.



Here is the Kirupa tutorial: http://www.kirupa.com/developer/mx/loadingrandombackground.htm



Thanks!

Random Background Help
I followed this tutorial.
http://www.kirupa.com/developer/mx/l...background.htm
It is a step by step guide on how to load a random background image. It loads a .swf into a movieclip on your main timeline. I did everything right, but the thing is, is that I am trying to load the image into a movieclip thats inside of another movieclip. For example it says to load the image into the movie "location." I need to load it into "background" then "location."

The gist of the code says.
choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
location.loadMovie("image0.swf");
break;

now if i need to put it into another movieclip dont i do this?

choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
_root.background.location.loadMovie("image0.swf");
break;

Well I tried that and a bunch of other options, but it didn't work. Someone please help me. Even another link to some better tutorial will help. Anything. Thanks.

Jonathan

Random Background/animation ?
Hi folks,

i've got an question. I want to make an menu for my webpage and so i will creat some animation (example: a dot which follows a line) but i will make it five or six of this animations so that the menu dosn't will be boring. ok now i've got an question: is there a way to make this animations randomize? in one of my flash books i found a script to shange the background after every start (its the code for the background):

Go to an play (Random (_totalframes))

Here the background are on one frame per movie (as background). Is there a way to write an script to randomize some different screens and that there will be a random brake after one screent with the differnt animations (i thinks it's boring too if a animation will change after one ends). And how can i realize this random brake.

I hope someone can help me

Random Background Movieclips?
Hi,
I would like to have at least two different background movieclips - so that the background changes every time I enter my flash site.

Is this difficult? How can I do this?

Thanks // coala

Random Background Images
Hello,

I am using Flash v5.0 and I can't figure out how to make a random background image appear each time someone accesses my webpage...if anyone could help me it would be greatly appreciated!

Cheers,
Macohead

Random Color In Background
I have a Website built in MX with two basic colors in the background. I want to add a script that changes the two background colors on site randomly. The catch is that I have certian colors that I want displayed together. For example, blue and green are used together then pink and yellow and orange and blue. How could these colors switch based on every visit to the site, but remember it can't just be any random color it has to come from a set that I specify (blue/green, pink/yellow, orange/blue, etc.).

Thanks

Random Background Color
i googled this but a lot of sites talk about "background color"...

anyone know how to give the stage a random bg color out of a choice of say 4 or 4 defined colors?

a nice addition would be being able to get the webpage its sitting in to appear the same color, via php (or alternatively let the php get the random color and pass it to flash...)

any ideas?

EDIT: just realised the bg color of the movie is of course defined by the webpage its sitting in... so php can handle that.

but how about if i want to pass the rgb value that was chosen by the php into the movie to be used by symbols...?

Random Background And Txt File
I am trying to create a resizable flash file that will act as a background for my html/css website. Within the flash I want to have a script that randomly loads a jpg file from a specific folder on my server as well as a correlating txt file for that background. Here is an example of what I mean.

Say there is a movieclip named "background" and then a dynamic text area named "info" in the lower left-hand corner of the flash movie. I want a script to randomly load a jpg file (say 234.jpg) from a folder named "backgrounds" on the server. I also want it to load the correlating text file into the dynamic text area (234.txt) from a folder named "info". How would I do this and what would the script be?

NOTE: the names of the jpg and txt files would be 1.jpg, 1.txt, 2.jpg, 2.txt, etc.

Thank you for any help you can give!

-- K

Help Random Background Image
Hello guys, i need a hand please!!
Im trying to do a site but with a random backround.. add like 5 different images and make the background fit in the resolution of all computers and every minute make them change with an effect!
please if someone knows how can i do this that is not creating a movie clip symbol with animation cause that wont be random and wont fit in all resolutions.
Thank you guys!!
roth

How To Create A Random Background?
I am trying to create a Xmas crad, which atomatically loads one out of 10 backgrounds randomly. Is there any easy way to do that?

Thanks a lot!

Background Random Appearance
Hi

I am designing a flash area for a website, and what I want is for my small image of a cloud I made to pass across the stage (120 X 400) from right to left, across the stage. However, I would like the cloud to come in at random places, have random speeds, and be random sizes. I have no idea how to approach this. Any ideas would be really helpful

Thanks

[F8] Operation: Random Background?
How can a random background function be made?

I mean Im trying - very hard - to make a game like the game "Tanks", currently Im stuck with programming on the background generating.

By that I mean EASY ways to generate random backgrounds which 'ent too impossible.

Now I dont want to generate the Y position for 400 movieclips (1pixel wide) and then getting the proximity and recheck, reposition. Thank you

THx for any help I could get.
<Tongxn>

Random Background On Startup
looking for a script that loads on startup (onLoad) randomly from a selection a background....

Scripting A Random Background... How?
Ok,... another something I want to work out. If you scroll to the bottom of this page (I mean the very bottom... all the way down) You will see a little "kirupa.com" button with loads of little circles that look like they are blowing in the wind....

Its obvious this is tweening through a guide thats repeated... but I want a similar effect. With about 10 circles... I want them to vary in size and "_alpha" on every pass and every time take a diffrent course from left to right... if it is even possible have them follow the mouse aswell.

Thanks again

Merry Christmas <

Chris

Help On The Load A Random Background
I want to know what code I would use if I was to make the backgrounds load in order????

Loading A Random Background At 100%
how would you go about doing this. (ex http://hi-res.net )

I know how to do both indvidualy but i cant make it all work together!

any help would be apreciated

Random Background Question...
Hi,

I load a Random Background (for Home) in my movie, all works perfect. My question is:

Wenn I go back to Home (home button), I want to display the same Background that Flash loaded first.

Is there a way to do that?, to assign a variable to the movie that Flash loads?

I used this code to load the random movie:


choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
myemptymovie.loadMovie("image0.swf");
break;
case 1 :
myemptymovie.loadMovie("image1.swf");
break;
case 2 :
myemptymovie.loadMovie("image2.swf");
break;



And for the home button I use the same code but with:

on (release) {
choice = Math.round(Math.random()*5); …

Thanks for your help…

Random Background Swf Question
Hi all - hope you're all well

I have a question regarding the Random Background image/swf tut.

The AS that does the work is this:

ActionScript Code:
on (release) {    choice = Math.round(Math.random()*5);    switch (choice) {    case 0 :        location.loadMovie("image0.swf");        break;    case 1 :        location.loadMovie("image1.swf");        break;    case 2 :        location.loadMovie("image2.swf");        break;    case 3 :        location.loadMovie("image3.swf");        break;    case 4 :        location.loadMovie("image4.swf");        break;    case 5 :        location.loadMovie("image5.swf");        break;    }}


What I'd really like to do is make sure that on pressing F5 in the browser (IE) the next image is not a repeat of the previous randomly selected image.

Any ideas? (Sorry - me and AS still getting acquainted
Thx for any help.

Random Background Pic Freaking Out
Howdy all,

I have a flash exe on a CD. Every time the project loads it has a new background image. The AS for this works fine. However, every once in a while when the project is loaded the backgound becomes all the images flashing. I have 9 different images in 9 frames of a movie clip (called "theClip") and the AS is:

ActionScript Code:
choice = Math.floor(Math.random()*13); // returns an integer between 0 and 12theClip.gotoAndStop(choice);


So obviously there are times when the AS is being ignored and it's just playing all the frames of the clip. Unfortunately this CD is being given out to potential clients so I really need to find out if there is a way to prevent this from happenning.

Any ideas?

Random Motion Background
I am a very basic flash mx programmer and I am making an animated header for my website. I have started with Kirupa's tutorial on random motion with objects. Now what I want to happen is....

1. I want it to load the random motion.
2. I want it to then have layer above that fades in to a color.
3. I want the random motion to continue in the background while stuff above the transparent color is going. I.E. site name, description, etc.

I have tried create new layers and working on it but the random motion always repeats on one frame. I don't know how you can let the random motion continuely being sent back to frame 1 and have the stuff above it work. Any ideas?

Help Preloading A Random Background
I can't tell you how long I've slaved over this question. I would ultimately like to load a random background, but first I'm just trying to preload a script-defined background. This is the coding I'm at right now and it doesn't work at all; it just sits with an empty load bar and "NaN% loaded" as the text. Any help you guys could give me would be VERY MUCH appreciated. Thanks in advance!

Justin

Here's the script--

stop();
//pic folder name
folder = "pics";

//create Holder and place him
this.createEmptyMovieClip("image", 1);
image._x = 0;
image._y = 0;

//load the content
image.loadMovie(folder + "/background.jpg");

//declare and launch preload
var content = image;
loadNow(content);

function loadNow(content) {
//Turn on and initialize the preloader
_root.loadBar._xscale = 0;
_root.loadText = "0% loaded";
//Set an interval to update the loading progress
loadInterval = setInterval(checkProgress, 10, content);
}

function checkProgress(content) {
//Set all variables to default
var contentSize = 0;
var downloaded = 0;
var percntLoaded = 0;
//Get total and loaded bytes
contentSize = content.getBytesTotal();
downloaded = content.getBytesLoaded();
percentLoaded = Math.ceil(downloaded / contentSize * 100);

//Update the preloader display
_root.loadText = percentLoaded + "% loaded";
_root.loadBar._xscale = percentLoaded;
updateAfterEvent();

//Is everything loaded?
if (downloaded == contentSize && contentSize > 0) {
clearInterval(loadInterval);
}
}

Random Motion In Background?
Ive followed the random motion tutorial, http://www.kirupa.com/developer/acti...dom_motion.htm but it puts it on top of everything i already have. I need it as a background, how can i knock it down a couple of levels? Thanks in advance.

Random Background Question
Hi everybody

Sorry if that kind of question was posted before, but i can't find an answer presently.

I've tested successfully to adapt the "random background" tutorial. It works but I encounter a problem.
In some case the image do not load....
rem > all my swf files are ok and wok correctly
> so is my code
> it seems to be never the same (i've seen it on the deboger)



what can I Do ?
May I use another code...but I wonder what ?

Thank you so much and sorry for my weak english

Ikyo

http://www.kirupa.com/developer/mx/l...background.htm

Load A Random Background – And Then Another...
Hi

I've followed this tutorial:
http://www.kirupa.com/developer/mx/l...background.htm

and then looked through the forums to take it to the next level.

The next level beeing this; When the parent movie has loaded a random swf I want it to load another swf after – say 5 seconds – and then again after another 5 seconds...

How do I achieve that?

Here's the code that I'm using btw:

choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
location.loadMovie("image0.swf");
break;
case 1 :
location.loadMovie("image1.swf");
break;
case 2 :
location.loadMovie("image2.swf");
break;
case 3 :
location.loadMovie("image3.swf");
break;
case 4 :
location.loadMovie("image4.swf");
break;
case 5 :
location.loadMovie("image5.swf");
break;
}

Any ideas would be highly appreciated...

Loading Random Background
Hi, i read and completed the tutorial on this topic:

http://www.kirupa.com/developer/mx/l...background.htm

what i needed is something similar, except that my background image is a motion clip and instead of having external .swf, i need all the MC's in just one flash. How do i do that?
Thank you for a quick response


x.
Victor

Random Photo Background
I have a xml gallery and i want it's background to change randomly when i go to different photos, how is that anyone knows tutorials or how to do it?

Loading A Random Background
Hi everyone

This is my first post here, but i've used the excellent tutorials section on many occasions with great success

I now have a question re: Loading a Random Background

This will indeed work perfectly for what i want, my question is this;
can i get the same effect using jpgs from an external source?

thankyou for looking
Sue

Help On The Load A Random Background
I want to know what code I would use if I was to make the backgrounds load in order????

Loading A Random Background At 100%
how would you go about doing this. (ex http://hi-res.net )

I know how to do both indvidualy but i cant make it all work together!

any help would be apreciated

Random Background Question...
Hi,

I load a Random Background (for Home) in my movie, all works perfect. My question is:

Wenn I go back to Home (home button), I want to display the same Background that Flash loaded first.

Is there a way to do that?, to assign a variable to the movie that Flash loads?

I used this code to load the random movie:


choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
myemptymovie.loadMovie("image0.swf");
break;
case 1 :
myemptymovie.loadMovie("image1.swf");
break;
case 2 :
myemptymovie.loadMovie("image2.swf");
break;



And for the home button I use the same code but with:

on (release) {
choice = Math.round(Math.random()*5); …

Thanks for your help…

Random Background Swf Question
Hi all - hope you're all well

I have a question regarding the Random Background image/swf tut.

The AS that does the work is this:

ActionScript Code:
on (release) {    choice = Math.round(Math.random()*5);    switch (choice) {    case 0 :        location.loadMovie("image0.swf");        break;    case 1 :        location.loadMovie("image1.swf");        break;    case 2 :        location.loadMovie("image2.swf");        break;    case 3 :        location.loadMovie("image3.swf");        break;    case 4 :        location.loadMovie("image4.swf");        break;    case 5 :        location.loadMovie("image5.swf");        break;    }}


What I'd really like to do is make sure that on pressing F5 in the browser (IE) the next image is not a repeat of the previous randomly selected image.

Any ideas? (Sorry - me and AS still getting acquainted
Thx for any help.

Random Background Pic Freaking Out
Howdy all,

I have a flash exe on a CD. Every time the project loads it has a new background image. The AS for this works fine. However, every once in a while when the project is loaded the backgound becomes all the images flashing. I have 9 different images in 9 frames of a movie clip (called "theClip") and the AS is:

ActionScript Code:
choice = Math.floor(Math.random()*13); // returns an integer between 0 and 12theClip.gotoAndStop(choice);


So obviously there are times when the AS is being ignored and it's just playing all the frames of the clip. Unfortunately this CD is being given out to potential clients so I really need to find out if there is a way to prevent this from happenning.

Any ideas?

Random Motion Background
I am a very basic flash mx programmer and I am making an animated header for my website. I have started with Kirupa's tutorial on random motion with objects. Now what I want to happen is....

1. I want it to load the random motion.
2. I want it to then have layer above that fades in to a color.
3. I want the random motion to continue in the background while stuff above the transparent color is going. I.E. site name, description, etc.

I have tried create new layers and working on it but the random motion always repeats on one frame. I don't know how you can let the random motion continuely being sent back to frame 1 and have the stuff above it work. Any ideas?

Help Preloading A Random Background
I can't tell you how long I've slaved over this question. I would ultimately like to load a random background, but first I'm just trying to preload a script-defined background. This is the coding I'm at right now and it doesn't work at all; it just sits with an empty load bar and "NaN% loaded" as the text. Any help you guys could give me would be VERY MUCH appreciated. Thanks in advance!

Justin

Here's the script--

stop();
//pic folder name
folder = "pics";

//create Holder and place him
this.createEmptyMovieClip("image", 1);
image._x = 0;
image._y = 0;

//load the content
image.loadMovie(folder + "/background.jpg");

//declare and launch preload
var content = image;
loadNow(content);

function loadNow(content) {
//Turn on and initialize the preloader
_root.loadBar._xscale = 0;
_root.loadText = "0% loaded";
//Set an interval to update the loading progress
loadInterval = setInterval(checkProgress, 10, content);
}

function checkProgress(content) {
//Set all variables to default
var contentSize = 0;
var downloaded = 0;
var percntLoaded = 0;
//Get total and loaded bytes
contentSize = content.getBytesTotal();
downloaded = content.getBytesLoaded();
percentLoaded = Math.ceil(downloaded / contentSize * 100);

//Update the preloader display
_root.loadText = percentLoaded + "% loaded";
_root.loadBar._xscale = percentLoaded;
updateAfterEvent();

//Is everything loaded?
if (downloaded == contentSize && contentSize > 0) {
clearInterval(loadInterval);
}
}

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