# Load sound from folder randomly

**URL:** <https://forum.kirupa.com/t/load-sound-from-folder-randomly/131941>\
**Category:** Uncategorized\
**Created:** [December 21, 2004, 12:08pm UTC](https://forum.kirupa.com/t/load-sound-from-folder-randomly/131941 "2004-12-21T12:08:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarNiz](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@CarNiz](https://forum.kirupa.com/u/CarNiz)\
**Post date:** [December 21, 2004, 12:08pm UTC](https://forum.kirupa.com/t/load-sound-from-folder-randomly/131941/1 "2004-12-21T12:08:08Z")

</div>

[color=black][font=Arial]Hai… 🙂 [/font][/color]

[color=black][font=Arial]First, I create folder name [/font][/color][color=purple][font=Arial]Msound and has 4 mp3 files in there. Then I want to load/playing it randomly at Flash, my problem is when I run it the sound does not play, [color=black]c[/color][/font][/color][color=black][font=Arial]ould someone please tell me how to make it work.[/font][/color][color=purple][font=Arial]…any idea:h: The code look like this:[/font][/color]

On the main timeline:

[AS]SdnFx = [“Msound/a/ba1.mp3”,“Msound/a/ba2.mp3”,“Msound/a/ba3.mp3”,“Msound/a/ba4.mp3”]  
mySong = new Sound(this);  
mySong.loadSound(SdnFx[Math.round(Math.random()\*(SdnFx.length-1))]);  
mySong.start();[/AS]
