# How to auto-play music when page opens?

**URL:** <https://forum.kirupa.com/t/how-to-auto-play-music-when-page-opens/179550>\
**Category:** Uncategorized\
**Created:** [February 21, 2006, 5:46am UTC](https://forum.kirupa.com/t/how-to-auto-play-music-when-page-opens/179550 "2006-02-21T05:46:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![split67](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/split67/32/2089_2.png) [@split67](https://forum.kirupa.com/u/split67)\
**Post date:** [February 21, 2006, 5:46am UTC](https://forum.kirupa.com/t/how-to-auto-play-music-when-page-opens/179550/1 "2006-02-21T05:46:52Z")

</div>

So I have my index page completed and have the music controls working perfectly with the mp3 linked. All I need now is to have the music start when the page opens but still allow the user the control to start & stop using the buttons provided. I’ve attached the .swf to get an idea of what’s going on. Also, below is my code for the sound. Any help is greatly appreciated.

Thank You,  
Rob.

Sound control code:

var mcHolder:MovieClip = this.createEmptyMovieClip (  
“mcHolder\_1”);  
var snd\_1:Sound = new Sound(mcHolder);  
snd\_1.attachSound(“song”);

btPlay.onRelease = function() :Void {  
snd\_1.start();  
};

btStop.onRelease = function() :Void {  
snd\_1.stop();  
};
