A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to load random .swf's into "main".swf?

  1. #1
    Junior Member
    Join Date
    Jul 2002
    hello! i'm not sure if this is the right place to post this question..? if not, i'm sorry...
    anyways, here goes:

    i'm making a site for a band and have several .swf's with music clips being loaded to "main".swf
    after one and other, but i'd like the music clips (.swf's) to load randomly to get some variation. anyone have any idea how i can do this?

    thnx for any help!

  2. #2
    Junior Member
    Join Date
    Jul 2002


    hi, i'm new at Flash but I am learning. Try the following.
    __________________________________________________ _________
    swfFiles = new Array ("your1.swf", "your2.swf", "your3.swf");
    function randomBackground() {
    randomNumber = random (swfFiles.length);
    loadMovie (swfFiles[randomNumber], "_root.videos");
    __________________________________________________ _______

    With your swf files all in the same folder the above will work. Where "_root.videos"..."videos" is an empty MC placed on the main stage. the above is placed on the first frame on the MC you want the swf's to randomly show.

    I hope this helps.

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