# Pausing and resuming a looping sound

**URL:** <https://forum.kirupa.com/t/pausing-and-resuming-a-looping-sound/245632>\
**Category:** flash\
**Created:** [December 2, 2007, 5:19am UTC](https://forum.kirupa.com/t/pausing-and-resuming-a-looping-sound/245632 "2007-12-02T05:19:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon4341189](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@anon4341189](https://forum.kirupa.com/u/anon4341189)\
**Post date:** [December 2, 2007, 5:19am UTC](https://forum.kirupa.com/t/pausing-and-resuming-a-looping-sound/245632/1 "2007-12-02T05:19:12Z")

</div>

Hello all,

I am currently working on a class to control sound. Having tried various work arounds for the looping, it seems that I will only get a loop with out a break if i pass a looping parameter to the sound channel object.

Here lies my problem. When i paused the sound, i save the playback position into a variable, audioProgress.

I would resume the sound by using

```auto
 sndPlayback = sndSound.play(audioProgress, 2147483647);

```

This causes a problem such that if you let the loop play for a while, the number in audioProgress becomes rather big, and trying to resume will cause the authoring environment to crash. In addition to that, pausing and resuming the sound causes the sound to loop from that position offset.

```auto

private function stopAudio(event:MouseEvent):void{
   audioProgress = sndPlayback.position;
   sndPlayback.stop();
   stopbtn.buttonMode = false;
   stopbtn.removeEventListener(MouseEvent.CLICK, stopAudio);
   trace(audioProgress);
   playbtn.buttonMode = true;
   playbtn.addEventListener(MouseEvent.CLICK, playAudio);
}
		
private function playAudio(event:MouseEvent):void{
   sndPlayback = sndSound.play(audioProgress, 2147483647);
			
   playbtn.buttonMode = false;
   playbtn.removeEventListener(MouseEvent.CLICK, playAudio);
			
   stopbtn.buttonMode = true;
   stopbtn.addEventListener(MouseEvent.CLICK, stopAudio);
}

```

Any ideas appreciated.

Cheers 😃
