A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [Resolved] Random URL's

  1. #1
    Newbie Infantry infantry's Avatar
    Join Date
    Jan 2003
    Location
    Chi-Town
    Posts
    258

    Random URL's

    I have 10 different SWF movies.

    I want to make a banner out of them.

    At the end of each SWF movie I need to put a code that would randomly load 1 of the 10 defferent SWF movies.

    Can someone help me out? How can this be done or CAN it be done.

    Thnx!
    I'm still learning Flash!

  2. #2
    Senior Member wessamzeidan's Avatar
    Join Date
    Sep 2003
    Location
    Lebanon
    Posts
    160
    At the end of each movie, write this code

    moviename=["mov1","mov2"....]; //this array has the names of the other 9 movies
    loadMovieNum(moviename[Math.random(moviename.length)],1);

    tell me if it works
    Proudly a Palestinian

  3. #3
    Newbie Infantry infantry's Avatar
    Join Date
    Jan 2003
    Location
    Chi-Town
    Posts
    258

    Doesn't work...

    I input the script and there are no errors in the script but the movie just keeps playing in loops, doesn't go to a different movie.

    I tried to scripts:

    code:
    moviename=["movie1.swf","movie2.swf","movie3.swf","movie4.swf  ","movie5.swf","movie6.swf","movie7.swf","movie8.s  wf","movie9.swf","movie10.swf"]; //this array has the names of the other 9 movies
    loadMovieNum(moviename[Math.random(moviename.length)],1);



    and I also tried movie2 (without the extension)
    I'm still learning Flash!

  4. #4
    Senior Member wessamzeidan's Avatar
    Join Date
    Sep 2003
    Location
    Lebanon
    Posts
    160
    Ok, first of all, all these movies should be in the same folder

    second change this line

    loadMovieNum(moviename[Math.random(moviename.length)],1);

    to

    loadMovieNum(moviename[Math.random(moviename.length)],0);



    I'm almost sure it should work
    Proudly a Palestinian

  5. #5
    Newbie Infantry infantry's Avatar
    Join Date
    Jan 2003
    Location
    Chi-Town
    Posts
    258
    Here is the script I used:

    code:
    moviename=["movie1.swf","movie2.swf","movie3.swf","movie4.swf  "]; //this array has the names of the other 9 movies
    loadMovieNum(moviename[Math.random(moviename.length)],0);



    The movie now goes and when it reaches the frame with the code it goes blank.

    And I do have all my movies in one folder.
    I'm still learning Flash!

  6. #6
    Newbie Infantry infantry's Avatar
    Join Date
    Jan 2003
    Location
    Chi-Town
    Posts
    258
    Wessamzeidan, I found this tutorial. Except it works everytime the movie is loaded, I need it to randomely generate everytime the movie is over. Maybe you can show me how to make it work like that?


    http://www.flashkit.com/tutorials/Fl...-671/index.php
    I'm still learning Flash!

  7. #7
    Newbie Infantry infantry's Avatar
    Join Date
    Jan 2003
    Location
    Chi-Town
    Posts
    258
    Anyone?
    I'm still learning Flash!

  8. #8
    Senior Member wessamzeidan's Avatar
    Join Date
    Sep 2003
    Location
    Lebanon
    Posts
    160
    Hey sorry, there was a mistake, try it now

    moviename=["movie1.swf","movie2.swf","movie3.swf","movie4.swf ","movie5.swf","movie6.swf","movie7.swf","movie8.s wf","movie9.swf","movie10.swf"]; //this array has the names of the other 9 movies
    loadMovieNum(moviename[random(moviename.length)],1);
    Proudly a Palestinian

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