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




AS 2 LoadMovie NOT Random Order



I have a an array of external swfs set to load in random order each time page is loaded. The trouble is that there is often a repeat of the same swf 2 or 3 times in a row. Is there a way to eliminate the repeat or set the code so that the swfs load in order (not random) then repeat only when the order is finished? here's the code:filename = ["quotes2.swf", "quotes9.swf", "quotes3.swf", "quotes10.swf", "quotes15.swf", "quotes16.swf", "quotes18.swf"];path = "http://www.mywebsite.com/quotes/";i = filename.length;k = Math.floor(Math.random()*i);loadMovie(path+filename[k], movieTarget);Thanks!



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 09-10-2008, 11:06 AM


View Complete Forum Thread with Replies

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

Random Order
im loading a list of songs from an xml file and they are put into an array for an mp3 player im making...after it is loaded, i want to arrange an order for the mp3s randomly..what what im trying to say, is that i want to arrange a list of numbers in a random order without repeats...ie.

Code:
var array1:Array=[0,1,2,3,4];
i want to make a new array with the numbers 0,1,2,3, and 4 in a random order every time it is loaded...like:

Code:
ran_array=[2,4,0,3,1];

Random Order From XML - How To?
Hello all,

i've searched the forums, and have tried adding what i've found to my AS, but i can't seem to get it to work.....

i have images loading in from an XML file, however, i want them to show up in random order each time a person visits.

here is the current AS:


MovieClip.prototype.easeY = function(y) {
this.onEnterFrame = function() {
this._y = y-(y-this._y)/1.2;
if (Math.abs(y-this._y)<=1) {
delete this.onEnterFrame;
this._y = y;
}
};
};

images = new Array();
xml_file = "images.xml";


xmlload = new XML();
xmlload.ignoreWhite = true;
xmlload.onLoad = function(ok) {
if (ok) {
count = this.firstChild.childNodes.length;
for (var i = 0; i<count; i++) {
curNode = this.firstChild.childNodes[i];
images[i] = {path:curNode.childNodes[0].firstChild.nodeValue,link:curNode.childNodes[1].firstChild.nodeValue,caption:curNode.childNodes[2].firstChild.nodeValue};
}
boot();
} else {
trace("Could not load "+xml_file+".");
}
};
xmlload.load(xml_file);


// ------------------------------------------------------------

spacing = 5;
boot = function () {
for (var i = 0; i<images.length; i++) {
mc = container.attachMovie("thumbMC", "thumb"+i, i);
mc._y = i*(55+spacing);
mc.path = images[i].path;
mc.link = images[i].link;
mc.over.captionMC.caption.text = images[i].caption;
}
setRollOver();
};
setRollOver = function () {
this.onEnterFrame = function() {
if (this.mask.hitTest(_root._xmouse, _root._ymouse)) {
slideMenu();
}
};
};
slideMenu = function () {
diff = _root._ymouse-this._y;
scale = diff*100/this.mask._height;
target = -scale*(this.container._height-this.mask._height)/100;
this.arrows.easeY(diff);
this.container.easeY(target);
};


is there a way to make the .jpgs in my XML load randomly each time?

thanks for any help,
s.

Random Order
Hello everybody! I'm creating a sort of quiz with multiple answers and everything works fine.... What I would like is that every time the user enters the game, the multiple answers would be placed on a different position....
Is this possible????
thanx in advance...

Random Order
Hello everybody! I'm creating a sort of quiz with multiple answers and everything works fine.... What I would like is that every time the user enters the game, the multiple answers would be placed on a different position....
Is this possible????
thanx in advance...

LoadMovie Order?
Hi all

If I have three holder MCs, which are told to load movie1.swf, movie2.swf and movie3.swf in the same script, will they be loaded in any particular order or will they all charge down the bandwidth as a singular item?

Are there loading rules for things like this where the only thing setting them apart is their name? (i.e. 1, 2, 3 etc).

Cheers.

Random Play Order
I have made 4 sound files, and i want them to play in a random order..
here is what i have made:

Loop01 = new Sound();
Loop01.attachSound("loop01");
Loop02 = new Sound();
Loop02.attachSound("loop02");
Loop03 = new Sound();
Loop03.attachSound("loop03");
Loop04 = new Sound();
Loop04.attachSound("loop04");
Loop01.start(0, 1);
Loop01.onSoundComplete = function() {
"Loop" + random(1,4).start();
}

my problem is i dont really know how i should "do the rest"..
the 4 sound files should be played randomized.. not at same time,
but a random one of the four loops should start when the current one playing,
ends.. so it doesnt like the same loop on and on and on.. What would be the
"right" way to do it?.. have been working on it for some time now..
but cant seem to find a solution

Random Placement, But In Order?
I'm making a matching/memory game. I have 10 MCs placed in a grid with a specific X,Y location for each.

How can I randomly change their arrangement/order when you progress to the next level of the matching game?

I have found plenty of resources for random placement, but not at specific coordinates and in random order.

Thanks

Display Set Of Mc's In Random Order?
I have 20 movie clips that I want to flash individually to the user for a psychology experiment. I sort of understand the Math.random function, but how do I set it up so that all clips are eventually played?

ex:

display random mc (let's call it a)
remove a
display new random mc (b) (can be anything but a)
remove b
display new random mc (c) (can be anything but a or b)
remove c

etc.

thanks.

Display Set Of Mc's In Random Order?
I have 20 movie clips that I want to flash individually to the user for a psychology experiment. I sort of understand the Math.random function, but how do I set it up so that all clips are eventually played?

ex:

display random mc (let's call it a)
remove a
display new random mc (b) (can be anything but a)
remove b
display new random mc (c) (can be anything but a or b)
remove c

etc.

thanks.

Various Quotations In Random Order?
Hi again...

I would like to have an ongoing 'movie' on my flash site where various quotations are displayed in random order. (So that you don't get the same quote every time you visit).

Any ideas on how to do this? Is it too complicated for a newbie like me?

Much thanks!

Playing Two Mc In Random Order?
Hi friends,

I have 2 mc in one fla. I want to play them randomly when I open the flash..
I couldnt do..
I used this codes but nothing happens

I add codes to first layer.
I add them to different layers but same frame.

var myArray = new Array();
var shownArray = new Array();

var myRandom:Number;
var currentText:String;
var prevText:String;

myArray = ["mov_0","mov_1"];
shownArray = [];

function doRandom():Void{

if(myArray.length == 0){

myArray = shownArray;
shownArray = [];

};

myRandom = random(myArray.length);
txt.text = myArray[myRandom];
play();

shownArray.push(myArray[myRandom]);
trace("myArray : "+myArray);
trace("shownArray : "+shownArray)
myArray.splice(myRandom, 1);




};

var myInterval:Number = setInterval(this,'doRandom',2000);


stop();

Random Order In A Number
Hi foreros
I am trying to generate random numbers which will be the result of a random combination of the figures in a given number, for example, if I have
var num:Number=01234; the function should give me three posible combinations of the figures in it, such as 12034, 34120 and 41302.
Do I have to convert the number into an array?
Can anybody help me with the function?
Thank you in advance.

Random In A Pecific Order?
look at the file i uploaded... i have it duplicating mc's
on all of the screen and i want it to cover all of the
area and not have mc's one on top ov the other
in the file i made it will almost cover (with many many mc's)
and also then it takes out some once a while
can i make the random go in a way that in each place i will have only 1 mc? all together i'll need exactly 100 mc's

hope i explained my self good


and thank you very much for the... help

LoadMovie, Multiple Mc-s In Following Order
Hi all,

I have a main movie A (movie frame/interface) that I load external movies into by pressing different buttons (into a MC called "empty"). I was wondering, is there any way to make it so that it will play them all in order? I should note that I don't have the source files of the movies, so I can't pass the arguments in there.

So for example, user opens movie 1 - after the movie 1 finishes, it should load movie 2 automatically...the 3 ...4 etcetera.

I tried this on the first frame, in the hope that after playing the movie that's set to load on the first frame, it would load the 2nd movie and play it..but no luck. It just jumped to the 2nd movie rightaway.

loadMovie ("movies/movie1.swf", "empty");
stop ();
if (empty._currentframe == empty._totalframes) {
loadMovie ("bhmovies/movie2.swf", "empty");
}

Any ideas? can this even be done?


Thanks in advance,


Stepan

LoadMovie, Multiple Mc-s In Following Order
Hi all,

I have a main movie A (movie frame/interface) that I load external movies into by pressing different buttons (into a MC called "empty"). I was wondering, is there any way to make it so that it will play them all in order? I should note that I don't have the source files of the movies, so I can't pass the arguments in there.

So for example, user opens movie 1 - after the movie 1 finishes, it should load movie 2 automatically...the 3 ...4 etcetera.

I tried this on the first frame, in the hope that after playing the movie that's set to load on the first frame, it would load the 2nd movie and play it..but no luck. It just jumped to the 2nd movie rightaway.

loadMovie ("movies/movie1.swf", "empty");
stop ();
if (empty._currentframe == empty._totalframes) {
loadMovie ("bhmovies/movie2.swf", "empty");
}

Any ideas? can this even be done?


Thanks in advance,


Stepan

LoadMovie In Correct Order
Okay,

I have a movie that has multiple swf files that need loading into it.

The code I have used is very basic & looks like the following:


Code:
loadVariables ("myText.txt", "");
loadMovie ("slide1.swf", "page2a");
loadMovie ("slide1s.swf", "page2s");
loadMovie ("slide2.swf", "page3a");
loadMovie ("slide2s.swf", "page3s");
loadMovie ("slide3.swf", "page4a");
loadMovie ("slide3s.swf", "page4s");
loadMovie ("slide4.swf", "page5a");
loadMovie ("slide4s.swf", "page5s");
The problem is that Flash seems to load these files in any order. I need to make the script start to load the movies from "slide1.swf" downwards.

My first thought about this is to use some kind of array that loads the movie from the top of the list & begins to download it, then when its completed the download moves on to the next movie.

Im new to using arrays & I need to be shown how I could go about solving this problem.

Any help much appreciated... Thanks!

Loadmovie Order (or Level)?
I'm looking for help controlling 3 stacked up movie clips.

I want the user to click a button which will determine the order of the movieclip.

I have:
1 button ('button')
3 movieclips with 3 different swf files in them ('movie1' 'movie2' movie3)

Now if the user clicks on 'movie2', i want movieclip2 to be placed on top (picture the user pulling out a piece of paper from a stack and placing it ontop)

here's the code i'm working with so far:

button.onRelease = function() {
loadMovie("sample1.swf", movie1);
loadMovie("sample3.swf", movie2);
loadMovie("sample2.swf", movie3);
};


but i know theres a way to have the user determine the level order, but not quite sure how....can someone help?

Load Order With LoadMovie()?
I'm working on a application that needs to load in a bunch of SWFs and play them in order.

The obvious solution is a bunch of loadMovie() calls. Pretty straight forward. My question is whether or not there's any way to influence the order that they're loaded. Will they automatically load in the order that you make the loadMovie() calls? (is this a consistant behavior)

The only reference to load order I can find is the Load order in the publish preferences. Does anyone know if that applies to dynamic loading? I could easily load them into specific depths.

If anyone has any experience with this please let me know. I'm sure some experimentation could yeild some answers, but I'm on a tight deadline and was hoping someone might have already tried to do the same sort of thing.

Thanks

Random Order Of Elements In An Array?
how do you make the elements of an array to be in a random order? any ideas?

Playing Movieclips In A Random Order
Hey guys.

I am trying to develop a little presentation.

Even though I have been using flash for a while, my actionscripting leaves a lot to be desired.

My tweening is good though, so I wondered if anybody could help me put together the following description?:

Firstly, I have is a preloader followed by an 'intro' movie clip. Should this even be a movie clip? It only needs to play once. Should it be in its own scene?

Secondly, I have designed six movie clips that I need to play in a random order after the intro.

Thirdly, I have an 'outro' movie clip. Should this be a movie clip or have its own scene?

I'm sure this project invloves some pretty basic actionscripting, its just a shame it isn't basic enough for me!

I appreciate any help.

Thanks guys!

Load Movieclips In Random Order?
I have a mc = "thumbs_mc" this is empty

Inside thumbs_mc i have e.g. thumbnail1_mc, thumbnail2_mc etc up to a final total of around 30

thumbs_mc position on stage is defined by setProperty and I have positioned the thumbnails inside thumbs_mc on the stage.

What i want to achieve is that the thumbnail_mc's appear in a "random order" - I attempted to do it by simply a masking effect. i.e an extra box is made to appear each frame. However this didnt work

How could i do this via actionscript?
If an fla is needed, that can be done.

Load A Group Of MCs In Random Order...
I have a group of Movieclips that I want to load in a random order, until they are all loaded. In other words, when the movie starts, a random MC of the bunch would load, followed by another random, and on until they are all loaded.

Right now I have the MCs with a quick alpha fade in onLoad, problem is they all load at the same time, but what I'm trying for is an organic type of loading, like they're blooming up all over the place.

Make sense? I don't know how to attack this one, any help would be awesome!

Thanks,
Tim

Playing 2 Movies In Random Order
Hi friends,

I created two flashes (also two swf).
I want to add these flashes to two seperate frames as movie.

And I want them to play randomly when I open the flash on first time.

Ex. when I enter the page first flash will appear.
two hours later, when I enter the page second flash will appear..

how can ı do this in one swf..

thanks

External SWF's - LoadMovie - In A Specific Order
I have a couple external SWF's I'm loading upon a button click using this code:

on(release){
_root.gotoAndStop("one");
_root.songlist.songbox.gotoAndStop("song1");
_root.songlist.songbox.cdmc.loadMovie("song1cd.swf ");
_root.songlist.songbox.songmc.loadMovie("song1.swf ");
_root.now.gotoAndPlay("start");
}


I want to modify it so that the second external SWF, in this case "song1.swf" does not begin to load until the first external SWF "song1cd.swf" has completly loaded.

How do I do this?

Thanks

Quick Quest: Loadmovie Order
Hey out there;
quick question. On a button i have this...

on (release) {
loadMovieNum("chpt6music1.swf", 2);
loadMovieNum("chpt6e.swf", 1);
}

my question; when i have them in this order does that mean flash will load the music file first, and when that's loaded, will then load the chpt6 file?

I ask this because i want to keep the show rolling thus if flash loads one before the other then I want to make sure I put the smaller one on top.

OR does flash just cram both files in at once?

Thanks.
Hoss

Load Cards In Random Order On New Game
Hi i have 20 cards and a 'new game' button. Can anyone tell me how to make the cards load in random order each time the new game button is pressed?

Kez

Play Movie Frames In Random Order...
Is there a way to play frames from a movie clip in random order?
Thanks

[MX04] Show Images In Random Order
i have a client that started out loving my simple alpha fade movie of his portfolio images.
now he has asked me if they can appear in random order.
well, i don't have a clue and his site was gonna be inexpensive.
here's the link to his format test site.

http://www.amotionstudio.com/KDC.html

any ideas out there?

thanks in advance for your time.

Datagrid Results In Random Order.... Aaaaaaa
Hi all,

im having real problems with a datagrid sometimes returning results 1-9 in order correctly and sometimes returning them all over the spot please seee pics below. my actionscript isnt brilliant is there a way i can force it so the "pos" always show in order

Thanks for any light you can shine on this

Charlie

corrrect


incorrect


Heres my XML Code

PHP Code:



<Highscore>
<detail id="1" playername="John Marland" dealer="Lancashire" score="231906" datestamp="28-02-08" UserId="4" ></detail>
<detail id="2" playername="charlie davey" dealer="Lancashire" score="240207" datestamp="28-02-08" UserId="1" ></detail>
<detail id="3" playername="Gareth Banks" dealer="Cheshire" score="273945" datestamp="27-02-08" UserId="23" ></detail>
<detail id="4" playername="Lee Gibson" dealer="Lancashire" score="328147" datestamp="26-02-08" UserId="19" ></detail>
<detail id="5" playername="john pinches" dealer="Lancashire" score="334363" datestamp="22-02-08" UserId="18" ></detail>
<detail id="6" playername="Jane Milroy" dealer="Lancashire" score="351705" datestamp="28-02-08" UserId="25" ></detail>
<detail id="7" playername="claire nield" dealer="Lancashire" score="358339" datestamp="28-02-08" UserId="27" ></detail>
<detail id="8" playername="Peter Burleigh" dealer="Lancashire" score="403675" datestamp="28-02-08" UserId="26" ></detail>
<detail id="9" playername="Steve Gracie" dealer="Lancashire" score="416523" datestamp="21-02-08" UserId="16" ></detail>
</Highscore>




Heres the actionscript i use with my datagrid

PHP Code:



stop();


import mx.controls.gridclasses.DataGridColumn;
import mx.styles.CSSStyleDeclaration;


// Create new XML Object and set ignoreWhite true
book_xml = new XML();
book_xml.ignoreWhite = true;
// Setup load handler which just invokes another function
// which will do the parsing of our XML
book_xml.onLoad = function(sucess) {
    if (sucess) {
        processBook(book_xml);
    }
};
// Load up the XML file into Flash
book_xml.load('ReadScore.php');
// This is the function that will be called when
// our XML document is loaded succesfully
function processBook(xmlDoc_xml) {

    
    totalResults = xmlDoc_xml.firstChild.childNodes.length;
    shorthand = xmlDoc_xml.firstChild.childNodes;

    var characters = new Array();
    
    for (i=0; i<totalResults; i++) {
        

        idClipContent = shorthand[i].attributes.id;
        nameClipContent = shorthand[i].attributes.playername;
        dealerClipContent = shorthand[i].attributes.dealer;
        scoreClipContent = shorthand[i].attributes.score;
        datestampClipContent = shorthand[i].attributes.datestamp;
        UserIdClipContent = shorthand[i].attributes.UserId;

        characters[i] = [idClipContent, nameClipContent, dealerClipContent, scoreClipContent, datestampClipContent, UserIdClipContent];

    
    }
    
    for (var i:Number = 0; i<characters.length; i++) {
        var Pos:String = characters[i][0];
        var Name:String = characters[i][1];
        var Location:String = characters[i][2];



        Highmilliseconds = characters[i][3];

        Highseconds = Math.floor(Highmilliseconds/1000);
        Highminutes = Math.floor(Highseconds/60);

        HighminutesTXT = Highminutes;
        HighsecondsTXT = Highseconds-Highminutes*60;
        HightensTXT = Math.round((Highmilliseconds-Highseconds*1000)/10);
        if (HighminutesTXT<10) {
            HighminutesTXT = "0"+HighminutesTXT;
        }
        if (HighsecondsTXT<10) {
            HighsecondsTXT = "0"+HighsecondsTXT;
        }
        if (HightensTXT<10) {
            HightensTXT = "0"+HightensTXT;
        }
        var Score:String = HighminutesTXT+":"+HighsecondsTXT+":"+HightensTXT;

        var Date:String = characters[i][4];

        if (characters[i][5] == _global.UserId) {
            _root.HighlightedRow = i;

            _root.HighscorePosition = characters[i][0];
            _root.HighscoreLocation = characters[i][2];
            _root.HighscoreTime = characters[i][3];

            Highmilliseconds = characters[i][3];

            Highseconds = Math.floor(Highmilliseconds/1000);
            Highminutes = Math.floor(Highseconds/60);

            HighminutesTXT = Highminutes;
            HighsecondsTXT = Highseconds-Highminutes*60;
            HightensTXT = Math.round((Highmilliseconds-Highseconds*1000)/10);
            if (HighminutesTXT<10) {
                HighminutesTXT = "0"+HighminutesTXT;
            }
            if (HighsecondsTXT<10) {
                HighsecondsTXT = "0"+HighsecondsTXT;
            }
            if (HightensTXT<10) {
                HightensTXT = "0"+HightensTXT;
            }
            _root.HighscoreTime = HighminutesTXT+":"+HighsecondsTXT+":"+HightensTXT;

            trace("User Id match"+HighlightedRow);
        }
        dataGridMain.addItem({Pos:Pos, Name:Name, Location:Location, Total:Score, Date:Date});
    }
    
    
    
    dataGridMain.sortItemsBy("Pos");
    
    dataGridMain.getColumnAt(0).width = 50;
    dataGridMain.getColumnAt(1).width = 130;
    dataGridMain.getColumnAt(2).width = 150;
    dataGridMain.getColumnAt(3).width = 100;
    dataGridMain.getColumnAt(4).width = 100;
    
    dataGridMain.getColumnAt(0).resizable = false;
    dataGridMain.getColumnAt(1).resizable = false;
    dataGridMain.getColumnAt(2).resizable = false;
    dataGridMain.getColumnAt(3).resizable = false;
    dataGridMain.getColumnAt(4).resizable = false;


    dataGridMain.setPropertiesAt(HighlightedRow,{backgroundColor:0x7ABB3B,color:0x000000});


}

function dataGridFunction() {


    var sortListener:Object = new Object();
    sortListener.headerRelease = function(event) {

        //specifying the column index number
        var columnIndex:Number = 1;

        if (event.columnIndex == columnIndex) {
            var arrayOrder:Number = Array.NUMERIC;

            if (dataGridMain.sortDirection == "DESC") {
                arrayOrder = arrayOrder | Array.DESCENDING;
            }
            dataGridMain.sortItemsBy(dataGridMain.getColumnAt(columnIndex).columnName,arrayOrder);
        }
    };



    dataGridMain.addEventListener("headerRelease",sortListener);
    dataGridMain.addEventListener("sortByNumber",this);
    dataGridMain.setStyle("fontFamily","Verdana");
    dataGridMain.setStyle("color","0xffffff");
    dataGridMain.setStyle("borderStyle","none");
    dataGridMain.setStyle("headerColor","0x491760");
    dataGridMain.setStyle("alternatingRowColors",["0xAD27A0", "0xD33DC5"]);
    dataGridMain.setStyle("rollOverColor","0xDCEBF1");
    dataGridMain.setStyle("selectionColor","0xffffff");
    dataGridMain.setStyle("selectionDuration",300);


    var styleHeader:CSSStyleDeclaration = new mx.styles.CSSStyleDeclaration();
    styleHeader.styleName = "myStyleHeader";
    styleHeader.fontFamily = "Verdana";
    styleHeader.fontSize = 10;
    styleHeader.fontWeight = "bold";
    styleHeader.color = 0x000000;
    _global.styles["myStyleHeader"] = styleHeader;

    dataGridMain.setStyle("headerStyle",styleHeader);
    dataGridMain.setHeaderHeight(25);
    dataGridMain.setStyle("headerColor",0xFFFFFF);

    dataGridMain.setRowHeight(25);

    dataGridMain.setStyle("hGridLines",false);
    dataGridMain.setStyle("hGridLineColor",0xC1D1E0);
    dataGridMain.setStyle("vGridLines",false);
    dataGridMain.setStyle("vGridLineColor",0xC1D1E0);

    dataGridMain.setStyle("borderStyle","none");
    // top
    dataGridMain.setStyle("buttonColor",0xFFFFFF);
    dataGridMain.setStyle("highlightColor",0xFFFFFF);
    // right and left
    dataGridMain.setStyle("borderCapColor",0xFFFFFF);
    dataGridMain.setStyle("shadowCapColor",0xFFFFFF);
    // bottom
    dataGridMain.setStyle("shadowColor",0x336699);
    dataGridMain.setStyle("borderColor",0xFFFFFF);

}

dataGridFunction();

Remove Clips From Stage In Random Order
Hello,
I have 6 letters accross the stage on layer 1. I then attach 6 instances of a movie clip from the library accross the stage to cover them using a for statement, so far so good.

Now I want to randomly remove them 1 by one. Any ideas? Here is what I have so far..


ActionScript Code:
var main:MovieClip = this;
var numOfLetters:Number = 6;
var nInterval:Number;
var randomRemoval:Number;
//attach 6 instances to the stage 50 px apart to cover letters//
for (i=0; i<numOfLetters; i++) {
    cover = main.attachMovie("cover", "cover"+i, i);
    cover._y = 50;
    cover._x = i*50;
}
//remove the 6 cover instances 1 at a time from the stage//
nInterval = setInterval(remove, 1000);
function remove() {
    randomRemoval = Math.round(Math.random()*numOfLetters);
    cover/*??*/.removeMovieClip();
}

cheers for any suggestions in advance.

---

Random Array Order For Sound Object
Here's the code I have currently which calls any one of three sounds from the library:

Quote:




mySongs = new Array("BGMusic1", "BGMusic2", "BGMusic3");
thisSong = mySongs[Math.ceil(Math.random()*mySongs.length-1)];
myLoop = new Sound(soundclip_mc);
myLoop.attachSound(thisSong);
myLoopVolume = 75;
myLoop.setVolume(myLoopVolume);
myLoop.stop;
myLoop.start(0,999);




This works fine. Every time the user reloads the page, there's a 66.66% chance that the song will be different. The problem is that currently the same tune plays over and over, leaving the other two out completely, unless the user decides to reload, which I don't actually want to have happen anyway. Any thoughts as to how to modify the code so that other two songs will play in succession, and then loop.

Who Can I Play 50+ Movie Clips In A Random Order
I have a movie which displays a number of movie clips in a random order...or so that's what I want it to do. Can someone direct me to the proper scripting so I can learn it?

I want the the movie to begin with the first random movie clip, play it till the end, pause for about 10 seconds and then move to the next random clip.

Thanks
Nick

Pulling And Playing Movies In Random Order
I want to set up a fairly simple slideshow of movies. Basically, they'll all be similar, fading a photo in, pausing, then fading it out. What I'd like is for it to pull the movies at random, so the slideshow doesn't just play through exactly the same every time you open the page. Is there a way to actionscript that?

Bonus points if there's a way to set it up on two layers so that while one photo is fading out another can be fading in, and we could have each layer pause "X" number of frames before starting a new movie clip, so that they appropriately overlap. I have it in my head how it will work, I'm just not sure how to actionscript it.

Thanks for any help!!! :)

[MX] How Do I Preload Multiple .swfs In RANDOM Order?
I've got a Flash file that displays a series of .swfs one after the other and I'm trying to figure out how to encorporate a preloader into this script that takes into account the fact that I'm randomly selecting which of those .swfs to display first.

Here's what the attached script does so far:
1. Call external XML file and put .swf path names into an array.
2. Randomly select one of those .swfs to display first.
3. Once that .swf movie has played through (each one is about 6 seconds long) --OR-- if the "next" button is clicked, load the next .swf file.
4. When we've reached the last .swf file in the list, start back at the beginning of the list.


I have looked at a BUNCH of preloader scripts but just haven't grasped actionscript enough to know how to encorporate them into my file.

Thanks in advance.

[MX] How Do I Preload Multiple .swfs In RANDOM Order?
I've got a Flash file that displays a series of .swfs one after the other and I'm trying to figure out how to encorporate a preloader into this script that takes into account the fact that I'm randomly selecting which of those .swfs to display first.

Here's what the attached script does so far:
1. Call external XML file and put .swf path names into an array.
2. Randomly select one of those .swfs to display first.
3. Once that .swf movie has played through (each one is about 6 seconds long) --OR-- if the "next" button is clicked, load the next .swf file.
4. When we've reached the last .swf file in the list, start back at the beginning of the list.


I have looked at a BUNCH of preloader scripts but just haven't grasped actionscript enough to know how to encorporate them into my file.

Thanks in advance.

Random Movie Clip Duplication In Order
random movie clip duplication in order
i have 48 boxes, each row has 9 boxes and each column has 6 boxes so it is 9 x 6. Each box size is 80 by 80 pixels with 2 pixels between each box vertically and horizantally.

when my movie starts, i want the initial box1_mc clip to duplicate itself randomly to generate 48 boxes on the stage in their spot.

How do i achieve this. I know how to duplicate them randomly on stage but not in their actual spot and remember that they only have to be duplicated only once.

Please help!

Random Movie Clip Duplication In Order
i have 48 boxes, each row has 9 boxes and each column has 6 boxes so it is 9 x 6. Each box size is 80 by 80 pixels with 2 pixels between each box vertically and horizantally.

when my movie starts, i want the initial box1_mc clip to duplicate itself randomly to generate 48 boxes on the stage in their spot.

How do i achieve this. I know how to duplicate them randomly on stage but not in their actual spot and remember that they only have to be duplicated only once.

Please help!

Removing Randomly Created Boxes In Random Order
Hi I'm a newbie looking for a shove in the right direction. Hopefully someone can help me out!

First of all, I'm using Flash MX and here's what I'm trying to do:

Add a random number of MC instances to a grid and then remove them in a random order.

I've done a fair bit of reading and I'm ready to jump in... I think. From what I've read, this seems like a job for an array. Is that the right direction for what I'm trying to do???

Thanks in advance!

Play Movie Clip Frames In Random Order?
I'm sure there is a way to do this, but I can't seem to find anything. May I ask, how I would play movie clip frames in a random order?

Thank you

Loading Multiple Movie Clips In Random Order
I have a flash file that loads random movie clips. The code below is on frame 1. I have a gotoAndPlay at the end of the timeline to start it over so it will cycle through all of the clips instead of playing one. I don't think this way is really the best way to do it...but it's what I have so far. Ideally what I need to do is have it cycle through the movie clips in random order, preferably not starting over until it has gotten through them all, but at least not playing the same one twice in a row. Any suggestions are greatly appreciated.










Attach Code

filename = ["rc.swf", "sealy.swf", "labcorp.swf", "baldor.swf", "parker.swf", "sae.swf", "philips.swf", "electrolux.swf", "cox.swf", "gojo.swf", "dolby.swf", "3m.swf", "loreal.swf", "icg.swf", "carlon.swf", "ici.swf", "redcross.swf", "rainsoft.swf", "lt.swf", "gentek.swf", "lesco.swf", "br.swf", "tremco.swf", "ra.swf", "novartis.swf", "ss.swf", "jabil.swf", "tcp.swf"];
path = "http://www.tmrdemos.com/tmrwebnew/flashlogos/";
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], movieTarget);

Make Music Player Play In Random Order?
I have an mp3 player which is driven by an XML playlist which currently plays from frist song to last song but I'd like to be able set it up so songs in the xml playlist play in random order. Any suggestions?

Thanks

Movie Clips Appearing On Stage In Random Order?
Hello flasher,

I was wondering if anyone can help me out on this little setup. Lets say i create 6 movie clips by drawing out 6 squares:

width: 80
height: 40

then I move them to off stage somewhere. Stage dimensions are:

Width: 1000
heigth: 600

I want to load my 6 movie clips (6 sqaures) in random order onto on lets say left hand corner of my stage within first left corner. I want clips to move in (animate in) from off stage to assigned stage location.

This is what I understand:

I will create:

onClipEvent (load) {

width = 600;
height = 800;
speedX = 5;
}

onClipEvent (enterFrame) {

this.movie1_mc._x = Math.round(Math.random()*5);

}

and so on and on....

I will eventually work in the speed.

I have tried moveTo() function but it doesnot fulfill the animation requirement which I would like to see. moveTo() simply puts the object to x and y assigned cordinates where as I want function that would show visual move.

Any help would highly be appreciated.

Thank you.

T

Drag+drop; 1 Element At A Time, Random Order, No Repeat
I am producing a drag and drop exercise, where the user drags a description of a word, and has to match it with the correct word.

The 7 descriptions appear at random, one at a time, each time the user clicks on the 'generate description' button.

*The problem I am having is that I only need each phrase to appear once and once it has appeared, it cannot be generated again. Instead flash should know this and instantly generate an unused number.

I have been looking at making 2 arrays, one with unused numbers and one with used numbers. However I have never created arrays before and I am stuggling with that.

I can attach the .fla as it will be easier for you to see what I am trying to do, but I am not sure if this is allowed. please advise on this, guys.

Thanks in advance if you can help,
Mark

Flash Game (How Do I Display Moving Items In Random Order?)
Ok
I'm creating my first game in Flash mx.
Its a conveyor belt game where toys move from left to right. There are several boxes located underneath the belt.
The user has to drag and drop each toy into its correct box.

I want each toy to continously come out in a random order.

(1 idea) randomly select movie clips from the library?
each movie clip representing a toy.

any suggestions at all wud be welcome!

thanks

Flash Game (How Do I Display Moving Items In Random Order?)
Ok
I'm creating my first game in Flash mx.
Its a conveyor belt game where toys move from left to right. There are several boxes located underneath the belt.
The user has to drag and drop each toy into its correct box.

I want each toy to continously come out in a random order.

(1 idea) randomly select movie clips from the library?
each movie clip representing a toy.

any suggestions at all wud be welcome!

thanks

Problems Using Array To Place Movieclips In Precise Location But In Random Order
Hi everyone,
I'm trying to create a memory game for my kids at school (using Flash MX 2004 on a mac). You know where you have to turn over two cards at a time and try and match them. Obviously each time the game is played the cards need to be in a different location. I borrowed a piece of code for randomly loading movieclips without repeating from another file I had asked for help with previously, which worked very successfully. But I'm having problems adapting it to fit my needs.

I have placed empty 24 movieclips on the stage so that I can place the cards in nice neat rows. In frame 1 I used this code:

code: allLocations = new Array();
allLocations.push ("location1","location2","location3","location4"," location5",....etc);

Then on a start button I used:
code: on (release) {

randNum = Math.floor(Math.random()*allLocations.length);
nextLocation = allLocations.splice(randNum,1);
_root.attachMovie("card1","card1",1);
_root["card1"]._x = _root["location" +randNum]._x;
_root["card1"]._y = _root["location" +randNum]._y;
randNum = Math.floor(Math.random()*allLocations.length);
nextLocation = allLocations.splice(randNum,1);
_root.attachMovie("card2","card2",2);
_root["card2"]._x = _root["location" +randNum]._x;
_root["card2"]._y = _root["location" +randNum]._y;

randNum = Math.floor(Math.random()*allLocations.length);
nextLocation = allLocations.splice(randNum,1);
_root.attachMovie("card3","card3",3);
_root["card3"]._x = _root["location" +randNum]._x;
_root["card3"]._y = _root["location" +randNum]._y;

and so on....

This seemed to work at first but when I test my movie things go wrong. The incorrect number of movieclips are placed and sometimes moviecips are placed at (0,0) (where I don't have a "location").

Does anyone have any ideas, please?
Thanks,
Alun

Random LoadMovie ?
Need to randomly load a movie(SWF) into a level of the base movie(SWF) each time it loads.

I have several separate audio SWF files (song1.swf, song2.swf, song3.swf, etc.) and I want to randomly load one each time a user hits the interface file.

Random SWF Using LoadMovie
I would like to randomly load a series of external images into my Flash file. Since Flash 5 does not support external linking to image files, I have to place images into a SWF movie, and then randomly load the external movies.

If someone has a script for this, or knows where I could find this, I would be greatful.

Thanks

Random Loadmovie
Hello, I'm a new member of these forums and not quite sure where to post this.... hope this is an appropriate spot!

What I am trying to do is have a random image with it's specific link appear on my HTML-based page (sort of like a banner). I'd rather not use CGI, so I figured there might be a way to have a flash movie load a random swf inside of itself. Is this possible?

Thank you.

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