Random MC Loading
Hi All,This is my first post here on Kirupa so forgive me for the n00b question!I am working on a site for a friend of mind, and what he wants is that when the page loads it will load in say 25 random movie clips that I have created. These movie clips should be randomly spread out on the page. And then when you press F5 to reload the page then another say 25 random clips get loaded on to the stage???I did see the Random movement tutorial on Kirupa but from what I gather it only loads in separate movie movies (.swf) files???I hope this made sense, and I hope some one out there can help!Thanks in advance people!Rob
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 01-02-2008, 12:13 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Sequencial Imagem Loading To Random Loading
I've downloaded a free script that reads several JPG files and it makes a sequencial slideshow.
This is the function used:
ImageFader.prototype.loadXML = function (x) {
var _xml = new XML ();
_xml.ignoreWhite = true;
_xml.path = this;
_xml.load (x);
_xml.onLoad = function () {
for (var a = 0; a < this.firstChild.childNodes.length; a++) {
var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
var _pause = this.firstChild.attributes.PAUSE
var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
this.path._dataProvider.push ({img:_img, transition:_trans, pause:_pause});
}
this.path.startFading ();
delete this;
};
};
My question is...
How to change that script to it loades random jpg from the xml in stead if loading img1, img2 from xml.
Anyone can help ? Thanks in advance
Loading Random Swf
Hey
I have created a series of external swf's and everytime somebody comes to my site a different movie must load.
Got some idea on how to do it but need some help
Cheers
ZieST
Loading Random .swf
Can anyone give me the script for a swf to load a random swf into it every time it's loaded/refreshed. Or tell me where I can find it.
thanks.
Random Loading
Vær hilset højtærede flashkit-medlemmer!
does anybody just happens to be in possession of a script that will load any one of a given number of movieclips by random?
it would be quit terrific and ease my Weltschmerz considerably
many greetings Mik
Loading A Random MC
Thanx to Mkit for help me withe following code:
_root.gotoAndPlay(name);
name = "F"+(random(6)+1);
Which allows my movie to jump to random spots using labels.
Now I need to modify it to load a random MC. I'm not to sure on how to naming structure goes.
How does it know to look for the MC in the library?
Do I use load movie to load it into a black MC on the stage?
Any help is apprectiated
Loading Random Swf
I've got 45 swf files from which I have to load 15 random files, but no file twice!
Any idea on what the best method is for picking 15 different numbers from a given 45 numbers?
Loading Random MCs
I have a few MCs that i want to randomly load...there my website sponsers ads. I would want it to change every so many seconds......How would i go about that?
Random Loading
Flash 5
I would like to load random bitmaps and swf's(or just swfs)
into a container movie. The random event would be on the
loading of the index page or swf.
Is there a standard random load scipt?
Would the code in the post above this one work?
Random Pic Loading
Alright. I want to have a random pic loaded up at the title of my SWF. How can i include the size of the .jpg in the preloader variables and make it load before it gets to the title?
the files are named something like
www.mysite.com/1.jpg
www.mysite.com/2.jpg
www.mysite.com/3.jpg
www.mysite.com/4.jpg
etc, etc.
I have had no problems simply loading the jpg onto the title screen, but the command to load it is AT the screen, so it sits there for a sec before the pic is loaded. I'm guessing i have to load it into the SWF at an earlier point, so it loads before it gets to the title, and then have it attach the already loaded pic.
that must've been a pain to read. i wonder how many times i said "load". anyway. thanks in advance.
Loading A Random Jpg
Ok on my stage I have a mc called "content_mc" which I want my jpg to be laoded into. My photos are stored in a folder called "main" and are name "1-10.jpg" Now I thought this script would work but it didn't.
content_mc.loadMovie("main/"+random(9)+1+".jpg");
Anyone have any idea on how I can get this to work?? Thanks in advance.
Random Loading
This one is a bit out of my expertise at the moment so I am hoping that someone can help.
I have a picture gallery that displays two pictures or .swf's at a time.
Is there anyway to get the main movie to randomly load two pictures from a choice of hundreds and to make sure it dosen't load the same picture twice in the same session OR day.
eg.
gallery one: loads two random pictures from a picture folder.
gallery two: loads two random pictures from a picture folder but remembers not to load the two pictures it has already loaded in gallery one.
gallery three: loads two random pictures from a picture folder but
remembers not to load the four pictures it has already loaded in gallerys one and two
etc..
Thanks in advance for any help you can give me. regards.
Random Loading?
Hi there, I am currently making an interactive flash where one must complete a certain amount of scenes/frames to complete this interactive flash.
However, I stumbled to a point where my AS knowledge has hit its dead end.
I currently have 5 files of .swf that I want to randomly load. My basic goal is to randomly load one of the 20 files in the parent flash movie, and once that movie is finished another random file would be chosen instead of the current flash, and once the next flash has been accomplished the movie will end with a great job! (7th) .swf
My files begin
1. intro <-parent flash
2. a.swf
3. b.swf
4. c.swf
5. d.swf
6. e.swf
7. Final Good job.swf
Basically for my first task, I want the movie to begin with
intro, once the button is prssed to assign a random movie:
_root.loadMovie("a.swf, b.swf, c.swf, d.swf, e.swf");
How do I randomize this?
thanks~
Loading Random PNG Using XML ...but
I am trying to do a random load of a transparent PNG images into my current flash movie. I figured out how to do it but the image always loads at the very top of the movie. Is there a way to tell the exact location of where I want the image to load. The only thing I can figure out is by using a button but the image still loads on the top.
Also was wondering by using XML and axtion script if it is possible to do a fade in.
Currently this is the script that I have
Action Script is as follows
Code:
imgXML = new XML();
imgXML.ignoreWhite = true;
imgXML.onLoad = function(ok){
if (ok){
images = imgXML.childNodes[0];
random_img_num = Math.round(Math.random()*(images.childNodes.length-1));
curr_img = images.childNodes[random_img_num];
trace(curr_img);
loadMovieNum(curr_img.attributes.src, 1);
}
};
imgXML.load("images.xml");
Here is my XML code
Code:
<?xml version="1.0" ?>
<images>
<image src="img/01.jpg" />
<image src="img/02.jpg" />
<image src="img/03.jpg" />
<image src="img/04.jpg" />
<image src="img/05.jpg" />
</images>
Loading Random Mc's
I've run into a problem...
I have 10 empty mc's on the stage, and I want to load 10 images into them randomly each time the movie is run, so they are in a different order everytime. I've created my array, but am now stuck...
How would be the best way to have each mc load an image, but without duplicating either so all 10 are there?
Thanks
Loading Random Mc
I feel like I am missing something ridiculously stupid here. I have been tearing my hair out for hours trying to figure out how to do something as simple as load a random mc in AS3.
the linkage names are set as Pic1, Pic2, etc all with a base class of MovieClip.
Here is the code of my movie.
var _pic1:Pic1 = new Pic1();
var _pic2:Pic2 = new Pic2();
var _pic3:Pic3 = new Pic3();
var _pic4:Pic4 = new Pic4();
var _pic5:Pic5 = new Pic5();
var _pic6:Pic6 = new Pic6();
var _pic7:Pic7 = new Pic7();
var newImage:*;
var allImages:Array = new Array();
allImages = ["_pic1", "_pic2", "_pic3", "_pic4", "_pic5", "_pic6", "_pic7"];
function findRandomimage (event:MouseEvent):void
{
newImage = allImages[Math.floor(Math.random() * allImages.length)]
trace(newImage)
addChild(newImage)
}
button.addEventListener (MouseEvent.CLICK, findRandomimage)
And here is the error message I am getting.
TypeError: Error #1034: Type Coercion failed: cannot convert "_pic4" to flash.display.DisplayObject.
at test_fla::MainTimeline/findRandomimage()
I would really appreciate any help. I've been trying to figure out this as3 stuff and still feel like an idiot
Thank you thank you,
bagooshi
Random Loading Plz Help
hai to all
i did 5 swf's and one main movie. i had loaded the small swf's into main movie. everthing is right and loading.
what i want is -> assume no. 4th swf is loaded in main swf againthe same 4th is loading i want a random one should load which is the not previously loaded. it should again do random and load the corresponding swf
it should not load twice the same one after the other same swf.
here is the code which i did here it is again loading the previous one plz help
var x:Number = random(5);
swf = "swf/" add "main" add x add ".swf";
_roothold_mc.loadMovie(swf, 1);
var secs = 3;
var id = setInterval(function () {
clearInterval(id);
play();
}, secs*1000);
stop();
Random Loading Plz Help
hai to all
i did 5 swf's and one main movie. i had loaded the small swf's into main movie. everthing is right and loading.
what i want is -> assume no. 4th swf is loaded in main swf againthe same 4th is loading i want a random one should load which is the not previously loaded. it should again do random and load the corresponding swf
it should not load twice the same one after the other same swf.
here is the code which i did here it is again loading the previous one plz help
var x:Number = random(5);
swf = "swf/" add "main" add x add ".swf";
_roothold_mc.loadMovie(swf, 1);
var secs = 3;
var id = setInterval(function () {
clearInterval(id);
play();
}, secs*1000);
stop();
Help With Loading A Random Jpg
Like the actionscript tutorial Kirupa has for loading a random movie clip I need something similar that loads from a folder containing jpg images randomly when the page is loaded / refreshed. Help on this would be extremely appreciated. Nothing fancy like the masks he has on it, just something plain and simple.
Loading Random .swf's
So I followed the loading random movies tutorial which seems pretty straight forward and simple.
I also tweaked the create a photo gallery tutorial to my liking in order to produce a movie that does automatic fade-in/fade-out transitioning.
I then used the random loader to grab one of my five transitioning .swf's and spit them up on the screen.
So here's the problem...
My random loader loads one of the five .swf's but it only displays the first image of that movie and then just sits there. I can reload the page again and it will load a different .swf, but still it just sits there on the first image of the .swf that is loaded.
Any help or suggestions would be great...
thanks!!
Loading A Random Swf
I want to load a random swf from a group of 6. Basically from the intial page i want the user to press a button and this then displays one of the 6 swfs randomly.
I have saved my swf files as numbers 1-6.swf and saved them in a folder called movies. I need to firstly generate a random number between 1 and 6 and then load this corresponding swf file.
Can anyone help me please?
Help With Loading A Random Jpg
Like the actionscript tutorial Kirupa has for loading a random movie clip I need something similar that loads from a folder containing jpg images randomly when the page is loaded / refreshed. Help on this would be extremely appreciated. Nothing fancy like the masks he has on it, just something plain and simple.
Loading Random FLV
I am building a site where the client wants to have their video (converted to flv) to play as soon as the user loads the site. I have one swf that is the shell for all the other parts of the site, and another swf that contians the video call. How can I have flash pick an flv randomly (from 33 different streaming servers to balance the load) and still only have swf for the video?
I've seen examples of this using playlists where the AS picks a flv from the playlist and plays it as soon as the previous vid has ended, but we only want this video to play once and then fade out (with AS that is already written and working).
Thanks in advance!
Random Loading
Trying to create a quiz that loads questions from an external xml file. Would like to create X number of quizzes and have Flash load the quizzes at random.
Any help appreciated.
Richie
Loading Random Swf Help
I seem to be having problems with some of my random movies loading. I have a main movie and little spiders(external swf's) are loaded randomly. The first one loaded is set in the main movie and after it plays at the last keyframe it loads another random spider swf. At the end of each frame for each spider it loads another random spider swf. The problem I seem to be having is that sometimes (even after the 1st random choice is loaded) it doesn't want to load another choice and stops. I have tried to count them to see if there is any pattern and if the loading stops after a certain amount of them have been loaded but sometimes it will stop after the first and other times it will stop after about 20. Everything works as it should except for when it just fails to load a new swf into that level.
Here is the code that I am using at the end of each spider swf to load the next random:
choice = Math.round(Math.random()*5);
switch (choice) {
case 0 :
loadMovieNum("spider.swf",5);
break;
case 1 :
loadMovieNum("spider1.swf",5);
break;
case 2 :
loadMovieNum("spider2.swf",5);
break;
case 3 :
loadMovieNum("spider3.swf",5);
break;
case 4 :
loadMovieNum("spider4.swf",5);
break;
}
Any help will be greatly appreciated,
Unsung
Loading Random .SWF
How do you load a set of random .swf files dynamically into a targeted movie instance?
I have 5 .swf movies that have tweened animations all of which consist of 500-2,000 frames and I want each individual .swf to play all of its frames before loading the next .swf file into the same targeted movie instance and I want it to load randomly into a movie clip.
Any ideas on how it can be done?
Random Loading Movie
Hello,
I have I main Swf file which is the main site. However i have 2 animations i want them to play randomly. They are not movie clips they are scenes ( actually 3 different files) Is there a way that i can randomly load them at the begining of the main site?
Any help would be greatly appreciated.
Thanks Alot
Jeff
Loading Random Movies
I have a base movie, into which I'd like to load any one of five movies into a higher level randomly. Once the second movie is loaded onto the first, I'd like to unload it when the next replaces it.
Currently, I'm using the If frameisLoaded command to load the next movie. How can I have that call one of the next 5 .swf files randomly? And if I target the same level will it merely replace the current swf in that level, making it unnecessary to use an unloadMovie command?
Thanks much!
Rick
RANDOM VARIABLE LOADING IN MC
Hey all,
I've gone through a few tutorials, had help from great people out there, and figured stuff out on my own too, I have one thing I just can't get yet.
On loading a text variable into the "show" movie clip I used the code
----
loadVariables("input.txt", _root.show);
----
But I also saw a way of keeping it refreshed pretty much everytime a person goes to it so they don't have to clear their cache. The only problem is that the example doesn't have the option of loading into a movie clip. It's this...
----
loadVariablesNum ("input.txt?Ran="+random(999), 0);
----
What I'm wondering is how do I tie them together, no matter how I do it, it gets an error as I publish.
This doesn't work but along the lines of...
----
loadVariablesNum ("input.txt?Ran="+random(999), 0, _root.show);
----
Everyone out there has been great today, any more help on this would be greatly appreciated!
thanx!
Random Loading Of External Txt?
hello.
id like to have a button load a random line from an
external txt file on release. if i have three lines in
the txt file the button would pick one of the three
lines randomly and put it in my text box...
any help on this would be great. tutorials or suggestions.
thanks.
d
Loading Random Scenes
I have 6 different logo loops in 6 different scenes and would like to load them randomly. I know must be a good way of doing this. Below is my first attempt. It doesn’t work. The script below is in the first frame of every scene. Please help.
whatLogoLoop = random(6) + 1;
if (whatLogoLoop = 1) {
gotoAndPlay("logo loop 1", 2);
}
if (whatLogoLoop = 2) {
gotoAndPlay("logo loop 2", 2);
}
if (whatLogoLoop = 3) {
gotoAndPlay("logo loop 3", 2);
}
if (whatLogoLoop = 4) {
gotoAndPlay("logo loop 4", 2);
}
if (whatLogoLoop = 5) {
gotoAndPlay("logo loop 5", 2);
}
if (whatLogoLoop = 6) {
gotoAndPlay("logo loop 6", 2);
}
Loading Random Scenes
I have 6 different logo loops in 6 different scenes and would like to load them randomly. I know must be a good way of doing this. Below is my first attempt. It doesn’t work. The script below is in the first frame of every scene. Please help.
whatLogoLoop = random(6) + 1;
if (whatLogoLoop = 1) {
gotoAndPlay("logo loop 1", 2);
}
if (whatLogoLoop = 2) {
gotoAndPlay("logo loop 2", 2);
}
if (whatLogoLoop = 3) {
gotoAndPlay("logo loop 3", 2);
}
if (whatLogoLoop = 4) {
gotoAndPlay("logo loop 4", 2);
}
if (whatLogoLoop = 5) {
gotoAndPlay("logo loop 5", 2);
}
if (whatLogoLoop = 6) {
gotoAndPlay("logo loop 6", 2);
}
Loading Bar With Random Swf Included
Hi..
i need to know how can i make a loading bar (percentage) for an swf that includes another swf. The problem is that this swf must be a random of different external movies (5 in total), so i don't know the weight of it.
(sorry cos my english, i hope somebody will understand..)
THANKS::
Random Movie Loading
Hello one and all.
I'm working on an interactive animation that is dependant on user input. This is not my problem.
Basically the user will end up at one of 12 different final solutions, depending on what info is entered. What I want to do is try and add an element of uniqueness by loading a random movie (e.g.; user input transports them to, say, scene 5 of 12, whereupon a random movie is loaded over the top of this scene (maybe movie 2 of 4, or something).
Does this make any sense?
I guess the script would go in the first frame encountered in each specific scene, but I'm unsure of exactly what it would be.
Anyone got any ideas?
Cheers
telekin:
__________________________________________________ __________
Loading Random Mc Into Flash
Hey Flash Gurus
Hoping I could get some help I am have just finished a site http://www.aceitsolutions.net but I want to put random elements into the site.
The site is one big flash file with a large splash graphic I want to make the splash graphic they see when the movie load to be different when they revisit the site.
What would you recommend for doing this and how..
Thanking you all in advance
David
Random Image Loading
hi there,
im trying to figure out/ write a script, so that everytime a user were to hit refresh, the swf would display a different image.
im assuming i would have to select a number by using random(5)
and then associate that number to a movieclip or scene.
if anyone has info or insights on how to go about this, i would really appreciate it.
an example of what i am talking about is here:
http://www.onenine.com/flash.html
thanks in advance -
jennifer
Random Loading Of Images
i use this actionscript to randomize the loading of an image that represent the background of my site;
_root.a = random(4);
if (_root.a=0) {
_root.loader.loadMovie("pfbg001.jpg");
}
if (_root.a=1) {
_root.loader.loadMovie("pfbg002.jpg");
}
if (_root.a=2) {
_root.loader.loadMovie("pfbg003.jpg");
}
if (_root.a=3) {
_root.loader.loadMovie("pfbg004.jpg");
}
it doesn't properly works... is there anybody who can help me? thx!!!
Random Level Loading
I have this small piece of actionscript that i've been given to load a random level:
loadMovieNum(["intro"+(random(6)+1)+".swf"], +(random(6)+1)+"1");
this loads 1 of 6 possible layers and, works fine but when it comes to unloading the layer I'm not sure which layer to unload. It looks as If it loads to level 1 but I've tried unloading levels 1 to 6 but no joy!
any ideas?
thanks,
jb
Loading Random SWFs
i've been searching and searching for inforation on how to do what i need to do, but haven't been able to find the right combination of features i need.
here's what i've got:
i've got an HTML page, and i have 3 Flash movies. the Flash movies are all about 80k, with preloaders. i need to do 2 things:
1) load a random movie every time the HTML page is refreshed.
2) cause a new, random, Flash movie to load every 20 second or so.
i found a reasonably helpful tutorial on how to do this, but unfortunately the randomly called SWFs are NOT utilizing their preloaders. when one SWF is finished playing and the script calls another random SWF, the movie hangs on blank space, ignores the preloader, and plays only after the whole new movie has loaded.
anyone have any suggestions?
Random Loading SlideShow
I'm creating a movie with a randomly loading slide show. The movie has 4 sets of 5 slides each that will randomly load everytime the page refreshs or that the site is revisited.
I am also tring to insert a menu on top of that slide show..
Does anyone know how this would be accomplished?
Loading Random Swf File
I am making a news scroller. And for this i have to load a random swf file containg the news. I want to load a random swf file every time a page is loaded from a specified folder and i want to add more news swf after some time. Is there a way that the parent flash movie can determine that how many swf files are there in a specified folder and can load a random file from that number of files. I dont want to use a text file in that way i have to update the text file each time i upload a new swf file.
Random Movie Loading
Hi all,
I wish to have an external MC load into my main timeline and be different with each viewers visit (i.e one of 4 MC's loads randomly and changes the next time they return). I am fine with the script to load the movie but need help with the 'making it random' side of things. All help appreciated
Random Loading (an Movie A Day)
I would like to have a movie load one of seven different .swf into an empty mc each day (so only mclip1.swf would load on monday, and only mclip2.swf would load on a Tuesday) one of seven for each day of the week. Can this be done? if so can someone tell me how?
cheers
Loading A Random Movie
hello,
can somebody show me how to load a random movie? i have a couple of different swfs that serve as the background to my site. when the background loads, i want it to pick either one or the other.
something like:
background = ["bk1.swf", "bk2.swf"];
something = random(2);
loadMovie(background[something], 2);
syntax might be a bit messed up there...so how can i make this work???
there really should be a loadMovie("bk1.swf" OR "bk2.swf", 2); type of thing!
thanks for your help!!!
Loading Random .SWF's And Pre-Load?
Hello all.
I'm working on a site where a random .SWF or Image will be loaded as a main menu whenever you enter the site. I was curious though, what is the best way to set-this up in terms of pre-loading? Since it will draw the random from another file stored in the same folder (say image1.swf or whatever) I'm assuming image1.swf -won't- preload with the rest of the movie, instead load on the fly when it's called on by the actionscript.
If this is the case -- it seems it will make for a really ugly pause of blank background.
Am I right on this, or can you make any suggestions?
Thanks all -
-AX1
Loading Random Text
I want to load a random text, (a random line from an external .txt file if possible), into a dynamic text field each time a button is clicked...
can anybody help me?
Loading Random Clips?
Please help! I have a set of movie clips that I want to play randomly in the main scene without the use of buttons. Tried my handy Flash 5 Bible to no avail.... any suggestions???
Loading Random External Mp3
Hi, I am trying to make a flash radio station. I am trying to use external mp3's that will be preloaded into flash like this. OnEnter it will load a random mp3 from a list of mp3's, then when the song is over it will load the next song in the list. I want the mp3's to start playing after about 1/4 of it has loaded (i think i just figured out how to load when 1/4 is loaded, by changing the "if blah == 100" to "== 25"). I can load the mp3's externally from a .txt list but im not sure how i would get it to play down the list after the first random mp3 is played, because i dont want it to just keep picking random mp3s, i want it to go to the next song, then next song, and so on. As for the preloader, i have seen it done so the bar preloader shows it loading and once gets to 25% loaded plays, but then also starts a smaller bar (like this: || ) which shows how far the song is in and such, a song status type thing.
I hope this isn't to confusing. I have seen the preloading done b4 and the random stuff too, so all i need to do it just combine them.
This is the random generator file i have,
http://www.flashkit.com/movies/Scrip...-165/index.php
I have a generic preloader also, im not sure if there is any way to change the actionscript so it can play after 1/4 loaded.
Loading Random Animations
Hi all,
Heres a simple one, I want to make a flash movie which contain several different animations( say 5?). How do I make each animation display randomly so that each time someone visits the site a different movie is played?
Thanks
Sampy
|