A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Random splash page

  1. #1
    Member
    Join Date
    Jan 2001
    Posts
    44
    I want to have random splash pages pop up when you type in the web page address.

    Examples of this would be:
    http://www.04.jp.org/ and
    http://www.surfstation.lu/

    Totally new to any kind of scripting, so explain it to me like I'm a four year old.

    Thanks in advance

  2. #2
    Senior Member
    Join Date
    Jun 2001
    Posts
    206
    The sites you specified don't use Flash, it's probably Java Script.
    It's possible to do in Flash, really easy too, but you've got to decide if you want to do it in Flash or not.

    Anyway, make a new MC and put another background in each frame and attach a STOP(); action to each frame as well.

    Put the MC on the main timeline and name it background

    Now, in frame 1 of the main timeline add this script:

    background.gotoAndStop (Random(5)+1);

    Provided you have 5 different backgrounds, the random function counts from 0,1,2,3,4 + 1 (because there's no such thing as a frame zero).

    Hope this helps you out!

  3. #3
    Member
    Join Date
    Jan 2001
    Posts
    44

    thanks

    Thank you. I'll try it. But let me ask you this... can I use these MC on the splash page as long as I have a plugin link or what would you suggest?

    My concern is with those that don't have the flash plugin installed.

  4. #4
    I plan to live forever or die trying
    Join Date
    Mar 2001
    Location
    Perth, W.A
    Posts
    206
    95% (i think) of the surfing dudes (internet users)has the flash plugin. And if you're still worried, make a link to the macromedia site, so they can download it.

  5. #5
    Member
    Join Date
    Jan 2001
    Posts
    44
    So let's say I have 20 different swf's and their html files ready to be randomized. Can I just import the swf into a mc and and put a stop after each swf has finished?

    Each swf will take up an average of 50 frames let's say. This will effect the ->background.gotoAndStop (Random(20)+1); will it not?


  6. #6
    Senior Member
    Join Date
    Jun 2001
    Posts
    206
    Hmm, if you want to use 20 different backgrounds, file size would become quite large I think (depends on what your backgrounds consist ofcourse).
    In that case I would probably randomly load a SWF.

    Let's say your swf files are named bg01, bg02...bg20
    I would add this script to the movie it's being loaded into:

    num = random(20)+1;
    loadMovieNum (bg&num, num);

    Now only 1 random movie is loaded, which speeds up the process.

    I am not sure this is really what you intend to do, but it gives you an idea, right?

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Location
    Seoul, South Korea
    Posts
    1,310
    Hi there,
    i know this is not the place to answer javascript questions but i think i can help. Place this script inbetween your <HEAD> tags of your HTML page:

    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    var howMany = 2; // max number of items listed below
    var page = new Array(howMany+1);

    page[0]="first.html";
    page[1]="second.html";
    page[2]="third.html";

    function rndnumber(){
    var randscript = -1;
    while (randscript < 0 || randscript > howMany || isNaN(randscript)){
    randscript = parseInt(Math.random()*(howMany+1));
    }
    return randscript;
    }
    quo = rndnumber();
    quox = page[quo];
    window.location=(quox);
    // End -->
    </SCRIPT>
    </HEAD>

    Be sure to change the values of page[0], page[2] etc to your specified URL's. If you need to add more URL's just increase the page[?] to whatever and don't forget to change the var howMany. Keep in mind that javascript counts from '0', not '1'.
    Cheers,
    micmac

  8. #8
    Member
    Join Date
    Jan 2001
    Posts
    44
    Originally posted by Volando
    Hmm, if you want to use 20 different backgrounds, file size would become quite large I think (depends on what your backgrounds consist ofcourse).
    In that case I would probably randomly load a SWF.

    Let's say your swf files are named bg01, bg02...bg20
    I would add this script to the movie it's being loaded into:

    num = random(20)+1;
    loadMovieNum (bg&num, num);

    Now only 1 random movie is loaded, which speeds up the process.

    I am not sure this is really what you intend to do, but it gives you an idea, right?
    The max file size is 6kb and total of all of them is 61.3kb (that's just the swf's)

    I simply want the user to be able to view a random swf upon typing in a http://www.whatever.com.

    But you've been more than helpful, both instances.
    Thanks. I'll keep trying... I'll learn eventually...

  9. #9
    Member
    Join Date
    Jan 2001
    Posts
    44
    If everything else fails me... this code is guaranteed to do it for me. Thanks.



  10. #10
    Senior Member
    Join Date
    Jun 2001
    Posts
    206
    You could also use the Java-script code. Are you planning to make a Flash-site, or is it just a splash-page? If so, you don't necessarily need to use Flash.

    Choices, choices...

    If you do want to use Flash, try the random load script, if your seperate background pics are only 6 kB each, at least it will be fast.

    Good luck with your project.

  11. #11
    Member
    Join Date
    Jan 2001
    Posts
    44
    It's a flash site, but I want the random splash page. I made the swf's and thought I could do something in flash, but the javascript will probably be easier this time around.

    They aren't just static backgrounds... some animation is involved with pretty much every one.

    Thanks for the good word. I'll have it up here for crtiticism once I get in up on the server and running smoothly.


  12. #12
    Member
    Join Date
    Jan 2001
    Posts
    44
    Got it up, but have a few questions:

    1.) how can I get it so that the window is at a fixed size upon loading
    2.) the movie size is 720x400 and want to keep the same ratio when the window opens up.
    3.) don't allow the user to resize
    4.) or perhaps embed the clip in the middle of the users window no matter what size it is

    http://www.widemouthmason.com/splash/widemouthmason.htm


    Thanks.

  13. #13
    Member
    Join Date
    Jan 2001
    Posts
    44
    Ok, this is now my problem. The following script will work in neoplanet, explorer but comes up with errors in netscape.

    Anyone tell me what might be wrong? I have no clue. Thanks.

    <html>
    <head>
    <title>WideMouthMason</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    var howMany = 19; // max number of items listed below
    var page = new Array(howMany+1);

    page[0]="one.htm";
    page[1]="two.htm";
    page[2]="three.htm";
    page[3]="four.htm";
    page[4]="five.htm";
    page[5]="six.htm";
    page[6]="seven.htm";
    page[7]="eight.htm";
    page[8]="nine.htm";
    page[9]="ten.htm";
    page[10]="eleven.htm";
    page[11]="twelve.htm";
    page[12]="thirteen.htm";
    page[13]="fourteen.htm";
    page[14]="fifteen.htm";
    page[15]="sixteen.htm";
    page[16]="seventeen.htm";
    page[17]="eighteen.htm";
    page[18]="nineteen.htm";
    page[19]="twenty.htm";

    function rndnumber(){
    var randscript = -1;
    while (randscript < 0 || randscript > howMany || isNaN(randscript)){
    randscript = parseInt(Math.random()*(howMany+1));
    }
    return randscript;
    }
    quo = rndnumber();
    quox = page[quo];
    window.location=(quox);

    </SCRIPT>
    </HEAD>

    <body bgcolor="#000000" text="#000000">
    </body>
    </html>

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