# How Do U Pause A Looping Music? Pls Help

**URL:** <https://forum.kirupa.com/t/how-do-u-pause-a-looping-music-pls-help/272857>\
**Category:** Uncategorized\
**Created:** [October 8, 2008, 10:21pm UTC](https://forum.kirupa.com/t/how-do-u-pause-a-looping-music-pls-help/272857 "2008-10-08T22:21:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajpar3](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rajpar3](https://forum.kirupa.com/u/rajpar3)\
**Post date:** [October 8, 2008, 10:21pm UTC](https://forum.kirupa.com/t/how-do-u-pause-a-looping-music-pls-help/272857/1 "2008-10-08T22:21:51Z")

</div>

Folks

How do u pause music which is looping-

My code below works fine but fails once the music loops. I’m doing something wrong here-

_var soundreq:URLRequest = new URLRequest("…/sound/music2.mp3");_  
_var sound:Sound = new Sound();_  
_var sndControl:SoundChannel = new SoundChannel();_  
_var sndVol:SoundTransform = new SoundTransform(0.2, 0);_  
_sound.load(soundreq);_

_var resumeSnd:Number = 0;_  
_var btnState:Number = 0;_

_// button to play & pause_  
_sndbars.buttonMode = true;_  
_sndbars.enabled = true;_

_sound.addEventListener(Event.COMPLETE, playSound);_

_function playSound(event:Event):void_  
_{_  
_sndControl = sound.play(resumeSnd, int.MAX\_VALUE);_  
_sndbars.addEventListener(MouseEvent.CLICK, soundStatus);_  
_sndControl.soundTransform = sndVol;_  
_}_

_function soundStatus(e:MouseEvent):void_  
_{_  
_if (btnState==1)_  
_{_  
_sndbars.play();_  
_sndControl= sound.play(resumeSnd, int.MAX\_VALUE);_  
_sndControl.soundTransform = sndVol;_  
_btnState =0;_  
_}_

_else_

_{_

_ **// the flaw is in this next line. if i remove it then the music will play normally from start** _  
_resumeSnd = sndControl.position;_  
_sndControl.stop();_  
_btnState =1;_  
_sndbars.stop();_  
_}_

_}_

Any insight would be of great help. Thx.
