[Laszlo-checkins] r12236 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9

bargull@openlaszlo.org bargull at openlaszlo.org
Thu Dec 25 09:24:53 PST 2008


Author: bargull
Date: 2008-12-25 09:24:50 -0800 (Thu, 25 Dec 2008)
New Revision: 12236

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
Log:
Change 20081217-bargull-wvj by bargull at dell--p4--2-53 on 2008-12-17 18:03:21
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: swf9 mp3 playback

New Features:

Bugs Fixed: LPP-7523

Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
- Call "stopPlay()" right after receiving "SOUND_COMPLETE", that way the workarounds from Max for LPP-7496 can be removed.
- Only rewind in "updatePlay()" when "play" is set to `true`.


    

Tests:
testcases from LPP-7496 and LPP-7523



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-12-25 17:21:55 UTC (rev 12235)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as	2008-12-25 17:24:50 UTC (rev 12236)
@@ -526,15 +526,11 @@
         * @return Number: the current frame when playback was stopped
         */
       private function stopPlay () :Number {
-          if (this.soundChannel) {
-             var frame:Number = Math.floor(this.soundChannel.position * 0.001 * MP3_FPS);
-          } else {
-             var frame:Number = this.frame;
-          }
+          var frame:Number = Math.floor(this.soundChannel.position * 0.001 * MP3_FPS);
           
           this.playing = this.owner.playing = false;
           this.removeEventListener(Event.ENTER_FRAME, soundFrameHandler);
-          if (this.soundChannel) this.soundChannel.stop();
+          this.soundChannel.stop();
           this.soundChannel = null;
           
           return frame;
@@ -556,9 +552,12 @@
           
           if (framenumber != null) {
               framenumber += rel ? fr : 0;
-          } else {
-              // start at the beginning again if we're already at the end.
+          } else if (play) {
+              // start at the beginning again if we're already at the end,
+              // but only if the music is going to be started (play=true)
               framenumber = fr >= this.totalframes ? 0 : fr;
+          } else {
+              framenumber = fr;
           }
           
           if (play) {
@@ -614,6 +613,7 @@
       private function soundCompleteHandler (event:Event) :void {
           // Event.SOUND_COMPLETE
           if (this.playing) {
+              this.stopPlay();
               this.frame = this.totalframes;
 
               // SoundChannel.position does not stop exactly at Sound.length, 
@@ -621,9 +621,6 @@
               // So instead of comparing 'frame' == 'totalframes', 
               // we'll send the 'lastframe'-event when playback stopped.
               this.owner.resourceevent('lastframe', null, true);
-              // needs to be reset again!
-              this.frame = this.totalframes;
-              this.stopPlay();
           }
       }
       



More information about the Laszlo-checkins mailing list