A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: LOADING IN RANDOM SWFS!!! help!

  1. #1
    Junior Member
    Join Date
    May 2001
    Posts
    7
    ok, here's whats up.

    i have a sound clip thats a swf, that loads into the main scene and loops forever.

    what i want to do is whenever you visit the site it loads a random swf. i have 6 swfs that are the sound loops.

    please help as i can't figure it out, and have searched the board and the tutorials...and shouted at the action script book. i am flumuxed.

    anyone?

  2. #2
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    You could use arrays and stuff but this method would be very simple.

    name your sound swfs sound1, sound2 etc

    where you put the command to load the sound, for the file name to load put

    ["sound" + (random(6)+1)+".swf"]

    and make sure expression is checked for that line in the actionscript dialog box.

    random(6) returns random numbers 0 to 5, so we add 1 to get 1 to 6.
    code says join the string "sound", and a random number 1to6 and string ".swf"

    Yes you could just have 1.swf and 2.swf but flash can behave unreliably when loading swf's that start with a number

    get it?
    feel free to ask more if you have probelms putting into your load code.
    [Edited by mgason on 05-31-2001 at 12:44 PM]

  3. #3
    Junior Member
    Join Date
    May 2001
    Posts
    7
    thanks so much for that, worked a treat.

  4. #4
    Senior Member
    Join Date
    Mar 2001
    Posts
    128

    having ramdom songs load is a great idea

    but right now i cant even get my mp3s to loop

    i have several mp3s stored on individual mc .swfs
    in each i tried to use the sound panel to loop but it dosent seem to work using the loadmovie level 5 method

    i have when the simple things take up days of my time
    thanks in advance

  5. #5
    Junior Member
    Join Date
    May 2001
    Posts
    7
    um..one more ask...

    ok i have got the random sounds working excellently.
    but i would like to be able to turn the sound on or off, i have had alook through the boards and tutorials and have not found much that can help.

    have you got any suggestions?
    will it be two buttons; one to set volume at 0, and one button to set the button up to 100 or somthing?

    any help would be great!

  6. #6
    Junior Member
    Join Date
    May 2001
    Posts
    7

    Re: having ramdom songs load is a great idea

    Originally posted by gogon
    but right now i cant even get my mp3s to loop

    i have several mp3s stored on individual mc .swfs
    in each i tried to use the sound panel to loop but it dosent seem to work using the loadmovie level 5 method

    i have when the simple things take up days of my time
    thanks in advance
    on my swf/loops, i have set sync; start and loops; 999 and that works for me.

    i dunno if thats a help or a hinderance.

  7. #7
    Senior Member
    Join Date
    Mar 2001
    Posts
    128

    what am i doing wrong?

    i also set my .swf mp3 to sync/start loops/999 with a fade effect and it dosent loop when i test movie

    not working for me with falsh5

    ???? any ideas?

  8. #8
    Senior Member
    Join Date
    Mar 2001
    Posts
    128

    works

    ok it works if effect is set to none
    but dont you want sync set to stream if you have a full length mp3? slower connections need streaming, right?
    if i do that then it dont loop
    [Edited by gogon on 06-01-2001 at 10:46 AM]

  9. #9
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Hi exeterblue,
    I have to admit to being in need of a serious upgrade on my flash5 audio skills.

    I have 2 links for you though with a bunch of audio tutorials. The killersound site is a great resource on all things audio, not just flash. The were-hree one has a couple of on/off tutorials

    I would also highly recomend you get the book Flash 5 studio from
    http://www.friendsofed.com/book_flash5studio.html
    you can buy it on amazon or wherever. It has a fantatic chapter on using the soundobject and seting up mixing and volume controls etc, all the source code and thorough instructions. Plus about 20 other chapters on other flash topics. Its the best flash book I have ever got.

    now those links
    http://www.were-here.com/cgi-bin/dbm...%20And%20Music

    http://www.killersound.com/cgi-bin/k...1/Catalog/1020

    good luck, mark

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