A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Randomly load different movies INSIDE a movie? Flash 4 or 5

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    21

    Randomly load different movies INSIDE a movie? Flash 4 or 5

    Is it possible to randomly load/display movies inside a .swf? For example, I'll use a simple java ticker effect with say 10 sentences.

    Can you randomly have let's say #3 scroll, then fade out (as an independent movie), then when it's done, have another random sentence, let's say #7 scroll, then fade out. And it just keeps randomly looping through those 10 sentences?

    I've looked around for a tutorial, but can't find anything.

  2. #2
    forever Newbie brunodario's Avatar
    Join Date
    May 2002
    Location
    Brasil
    Posts
    256
    HI there!
    I'm not sure if this is going to help (since it's MX code) but anyway this can give you a hint...yesterday i've made a random external movie clip load sucessfuly. My code looks like this

    Code:
    variavel = random(5);
    if (Number(variavel) == 0) {
        loadMovie("flash/orappa.swf", "discohold");
    } else if (Number(variavel) == 1) {
        loadMovie("flash/rappamundi.swf", "discohold");
    } else if (Number(variavel) == 2) {
        loadMovie("flash/ladobladoa.swf", "discohold");
    } else if (Number(variavel) >= 3) {
        loadMovie("flash/instinto.swf", "discohold");
    }
    Well... the fades you mention are not there... but at least you have a clue of how make the movie load randomly!
    I wanna ROCK

  3. #3
    Junior Member
    Join Date
    Dec 2002
    Posts
    21
    Thanks much, but I don't have Flash MX, I'm running 4 and 5

  4. #4
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    array

    nested if then elses can be long, I prefer arrays for multiple values. I think this should work in 5. If not, do a help search for "arrays" and "random function" for exact syntax.

    swfArray = new Array ("1file.swf", "2file.swf", "3file.swf", "4file.swf"... "10file.swf");
    function randomSwf() {
    randomNumber = random (swfArray.length);
    loadMovie (swfArray[randomNumber], "emptyMCinstanceName");
    }
    randomSwf();

  5. #5
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    P.S.

    Put the fades in each swf file. Fade in and fade out. That will create a smooth transition between them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center