# Playing music through action script

**URL:** <https://forum.kirupa.com/t/playing-music-through-action-script/63007>\
**Category:** Uncategorized\
**Created:** [September 2, 2004, 8:08am UTC](https://forum.kirupa.com/t/playing-music-through-action-script/63007 "2004-09-02T08:08:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blenderben](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blenderben/32/74_2.png) [@Blenderben](https://forum.kirupa.com/u/Blenderben)\
**Post date:** [September 2, 2004, 8:08am UTC](https://forum.kirupa.com/t/playing-music-through-action-script/63007/1 "2004-09-02T08:08:36Z")

</div>

i have this swf file where i play individual songs through actionscript

this is my code

1st frame

\_root.music = new Sound();  
\_root.music.attachSound(“file1”);  
\_root.music.start(0,99);

1st button

\_root.music.stop();  
\_root.music.attachSound(“file2”);  
\_root.music.start(0,99);

2nd button  
\_root.music.stop();  
\_root.music.attachSound(“file3”);  
\_root.music.start(0,99);

if i start the movie, it plays file1…_duh_ i press button 1, it plays file2…and so on…this whole thing works locally, but it doesn’t work on the internet. i posted it up on my webpage when it first loads, it plays like 1 sec of the music file and stops -\_- why?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2004, 11:09am UTC](https://forum.kirupa.com/t/playing-music-through-action-script/63007/2 "2004-09-02T11:09:14Z")

</div>

Skip the \_root;)  
firstframe

```auto
music = new Sound(this);
music.attachSound("file1");
music.start(0,99);

```

first button

```auto
music.stop();
music.attachSound("file2");
music.start(0,99);

```

scotty(-:
