# Attach Sound using ActionScript Preloader error

**URL:** https://forum.kirupa.com/t/attach-sound-using-actionscript-preloader-error/176061
**Category:** flash
**Created:** [January 19, 2006, 11:37pm UTC](https://forum.kirupa.com/t/attach-sound-using-actionscript-preloader-error/176061 "2006-01-19T23:37:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bzouchir](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bzouchir/32/2088_2.png) [@bzouchir](https://forum.kirupa.com/u/bzouchir)
#### Post date: [January 19, 2006, 11:37pm UTC](https://forum.kirupa.com/t/attach-sound-using-actionscript-preloader-error/176061/1 "2006-01-19T23:37:19Z")

</div>

HI guys and I really need your help on this one:

I’m attaching music to play in the background with volume control slider  
and everything works fine with the code below

onClipEvent (load) {  
mySound = new Sound();  
mySound.attachSound(“music”);  
mySound.start(0, 99);  
}  
onClipEvent (enterFrame) {  
mySound.setVolume(\_root.volume\*2);  
}

and that’s exactly what I want and it worked!..

But…:hurt:

What’s happening is that in the “Linkage Properties” for the sound I have:  
Export For ActionScript  
Export in First Frame  
both on

This is causing the preloader to load the sound on the first frame before displaying the preloader causing the preloader to display at almost 40%.

If I don’t tick “Export in first frame” the sound won’t export at all.

I checked this great link abt preloaders:  
[http://www.senocular.com/flash/tutorials/preloading/](http://www.senocular.com/flash/tutorials/preloading/)

and it explains clearly how to fix that but still It didn’t help cause I’m loading sound and not MC, or better admit I don’t know how to fix this problem :hurt:

Can anyone please help on how to fix this!? or just show me another way to do this?!  
I don’t want to load an external mp3 or swf cause I want it to play at a certain frame in the timeline and it’s the “background music” so it has to loop with volume control!
