|
91 | 91 | getDurationBySrc: handleGetDurationBySrc, |
92 | 92 | setLoop: handleSetLoop, |
93 | 93 |
|
94 | | - setMasterVolume: handleSetMasterVolume, |
| 94 | + setMasterVolume: handleSetMasterVolume, |
95 | 95 |
|
96 | 96 | command: handleCommand |
97 | 97 | }; |
|
106 | 106 | for (var n:String in map) { |
107 | 107 | ExternalInterface.addCallback(n, map[n]); |
108 | 108 | } |
109 | | - // NOTE this is in an ENTER_FRAME to deal with a race issue in IE caused by caching |
| 109 | + // NOTE this is in an ENTER_FRAME to deal with a race issue in IE caused by caching |
110 | 110 | this.addEventListener(Event.ENTER_FRAME, handleReady, false, 0, true); |
111 | 111 | } catch (e:*) { |
112 | 112 | handleError(e); |
|
207 | 207 |
|
208 | 208 | lookup[id] = wrapper; |
209 | 209 | wrapper.addEventListener(Event.SOUND_COMPLETE, handleSoundFinished, false, 0, true); |
210 | | - wrapper.addEventListener("loop", handleSoundLoop, false, 0, true); |
| 210 | + wrapper.addEventListener("loop", handleSoundLoop, false, 0, true); |
211 | 211 | wrapper.addEventListener("interrupt", handleSoundInterrupt, false, 0, true); |
212 | 212 | log("Play Sound", id, src, "o:",offset, "l:",loop, "v:",volume, "p:",pan, "sT:",startTime, "d:",duration, "mv:",masterVolume); |
213 | 213 | return id; |
|
222 | 222 | log("Complete", wrapper.id, "Remaining:", activeSoundCount); |
223 | 223 | } |
224 | 224 |
|
225 | | - // An instance loop callback. |
226 | | - protected function handleSoundLoop(event:Event):void { |
227 | | - var wrapper:SoundWrapper = event.target as SoundWrapper; |
228 | | - ExternalInterface.call(SOUND_CALLBACK, wrapper.id, "handleSoundLoop"); |
229 | | - log("Loop", wrapper.id, "Remaining:", wrapper.loop); |
230 | | - } |
| 225 | + // An instance loop callback. |
| 226 | + protected function handleSoundLoop(event:Event):void { |
| 227 | + var wrapper:SoundWrapper = event.target as SoundWrapper; |
| 228 | + ExternalInterface.call(SOUND_CALLBACK, wrapper.id, "handleSoundLoop"); |
| 229 | + log("Loop", wrapper.id, "Remaining:", wrapper.loop); |
| 230 | + } |
231 | 231 |
|
232 | | - protected function handleSoundInterrupt(id:String):void { |
| 232 | + protected function handleSoundInterrupt(id:String):void { |
233 | 233 | var wrapper:SoundWrapper = getWrapper(id, true); |
234 | 234 | if (wrapper != null) { |
235 | 235 | log("Interrupted", wrapper.id); |
@@ -582,17 +582,17 @@ class SoundWrapper extends EventDispatcher { |
582 | 582 |
|
583 | 583 | /** Get/Set the playhead position. */ |
584 | 584 | public function get position():Number { |
585 | | - if (channel != null && !_paused) { |
586 | | - return channel.position - this._startTime; |
587 | | - } |
588 | | - return offset; |
589 | | - } |
| 585 | + if (channel != null && !_paused) { |
| 586 | + return channel.position - this._startTime; |
| 587 | + } |
| 588 | + return offset; |
| 589 | + } |
590 | 590 |
|
591 | 591 | /** @private */ |
592 | 592 | public function set position(value:Number):void { |
593 | | - if (channel != null) { |
594 | | - channel.stop(); |
595 | | - } |
| 593 | + if (channel != null) { |
| 594 | + channel.stop(); |
| 595 | + } |
596 | 596 | startSound(value); |
597 | 597 | } |
598 | 598 |
|
@@ -652,17 +652,17 @@ class SoundWrapper extends EventDispatcher { |
652 | 652 |
|
653 | 653 | // Sound playback has completed. |
654 | 654 | protected function handleSoundComplete(event:Event):void { |
655 | | - offset = 0; // have to set this as it can be set by pause during playback |
656 | | - if (loop != 0) { |
| 655 | + offset = 0; // have to set this as it can be set by pause during playback |
| 656 | + if (loop != 0) { |
657 | 657 | //only decrement loop if it is not -1 |
658 | | - if(loop > 0) loop--; // NOTE this introduces a theoretical limit on loops = float max size x 2 - 1 |
| 658 | + if(loop > 0) loop--; // NOTE this introduces a theoretical limit on loops = float max size x 2 - 1 |
659 | 659 |
|
660 | | - startSound(offset); |
| 660 | + startSound(offset); |
661 | 661 |
|
662 | | - dispatchEvent(new Event("loop")); |
663 | | - } else { |
664 | | - dispatchEvent(event); |
665 | | - } |
| 662 | + dispatchEvent(new Event("loop")); |
| 663 | + } else { |
| 664 | + dispatchEvent(event); |
| 665 | + } |
666 | 666 | } |
667 | 667 |
|
668 | 668 | // An error has occurred. |
|
0 commit comments