Results 1 to 4 of 4

Thread: displaying 3 random flash movies

  1. #1
    Join Date
    Aug 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default displaying 3 random flash movies

    Hey guys,

    I'm stuck!
    I have to write or find a bit of code that can display random flash movies when the page is refreshed, i found loads that work but, i need it to work so that 3 different flash movies are displayed at the same time and they all change on refresh but never two of the same appear.

    I have currently written it so that it is 3 different codes for each one and only put certain flash movies into each ie;(flash1.swf and flash2.swf) are in one code and (flash3.swf and flash4.swf) are in the second etc.

    But the customer is not happy with this, he wants it so that all three display all the random flash movies and not just set into each one.

    Hope someone can figure out what im saying and help me!

    Thank youu

  2. #2
    Join Date
    Jan 2008
    Posts
    4,167
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Here's a script I made awhile ago, change the highlighted to your three movies. Tell me if anythings wrong, like if you want all three of them random? I can do that. Just tell me. Heres the random code(again, change the highlighted):
    Code:
    <script type="text/javascript">
    // Generate a Random Number
    var movieDis; //global variable
    var number = 2; //your number of videos -1
    var randomnumber = Math.round(Math.random()*number+1); //generate a random number between 1-number+1
    movie(randomnumber);
    
    //Functions to write out the correct flash movie resource.
    function movie(num){
    if(num == 1){
    movieDis = "Movie1";
    } else if(num == 2){
    movieDis = "Movie2";
    }else if(num == 3){
    movieDis = "Movie3";
    } else {
    movieDis = "There was an error. Please try again."; //error
    }
    document.write(movieDis);
    }
    </script>
    Jeremy | jfein.net

  3. #3
    Join Date
    Aug 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    here the link to what i have so far
    www.pcoleconsult.co.uk - you see on the right hand side there are 3 flash files that change on page refresh, but its not completly random all round, they are 3 seperate random scripts that each display 2 different files each.

    I would like it so that they are all linked together and they all display all the different files.

    ie. the first project can display all 7 projects and so can the second and third but no same project appears at the same time.

    hope this makes sense!!!

  4. #4
    Join Date
    Sep 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Headache

    Hi..

    I've got a selection of flash files that I would like to play in random - when people enter a site... (i.e. a teaser for each brand of products, when opening the site the intro should display a teaser from one of many brands/swf movies...)

    SWF files made in: SWiSH Max.

    Can't get the coding right, and if anyone could help I'd be very greatful..

    The code listed above has given me the most luck (shows file names in random - but not the actual files..) so far I've got three options, to view each, replace the last number in the link with 2 or 3... www.tennishuset.no/1.html

    Thanks...!

Bookmarks

Posting Permissions

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