# Loading an mp3 issue

**URL:** <https://forum.kirupa.com/t/loading-an-mp3-issue/290048>\
**Category:** Uncategorized\
**Created:** [June 9, 2009, 3:06am UTC](https://forum.kirupa.com/t/loading-an-mp3-issue/290048 "2009-06-09T03:06:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icekomo](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@icekomo](https://forum.kirupa.com/u/icekomo)\
**Post date:** [June 9, 2009, 3:06am UTC](https://forum.kirupa.com/t/loading-an-mp3-issue/290048/1 "2009-06-09T03:06:36Z")

</div>

Hey everyone,  
I am having trouble getting this to work the way I would like it to. Right now the mp3 has to load completely until it is able to play, I would like it to play as it is downloading. I know my problem lies with in the event.COMPLETE part of my code, I just don’t know what to change it too. Also when the mp3 starts to play it’s super load, I tried setting the volume but it didn’t seem to effect anything. Does any one have any ideas how I can alter my code to make those 2 features work?

code:  
// Sound Controls

var soundReq:URLRequest = new URLRequest(“Melt.mp3”);  
var sound:Sound = new Sound();  
var myTransform = new SoundTransform();  
var soundControl:SoundChannel = new SoundChannel();  
var resumeTime:Number = 0;

myTransform.volume = 0.5;  
soundControl.soundTransform = myTransform;

sound.load(soundReq);  
soundControl = sound.play(resumeTime);

sound.addEventListener(Event.COMPLETE, onComplete);  
[//sound.addEventListener](https://sound.addEventListener)(Event.ENTER\_FRAME, onComplete);

function onComplete(event:Event):void  
{  
//soundControl = sound.play(resumeTime);  
pause\_btn.addEventListener(MouseEvent.CLICK, pauseSound);

}

function playSound(event:MouseEvent):void  
{  
soundControl = sound.play(resumeTime);  
pause\_btn.visible = true;  
pause\_btn.addEventListener(MouseEvent.CLICK, pauseSound);  
play\_btn.visible = false;  
play\_btn.removeEventListener(MouseEvent.CLICK, playSound);  
soundControl.soundTransform = myTransform;  
}

function pauseSound(event:MouseEvent):void  
{  
resumeTime = soundControl.position;  
soundControl.stop();  
play\_btn.visible = true;  
play\_btn.addEventListener(MouseEvent.CLICK, playSound);  
pause\_btn.visible = false;  
pause\_btn.removeEventListener(MouseEvent.CLICK, pauseSound);  
}
