let END tags increase the frame count under special circumstances.
[swftools.git] / lib / rfxswf.c
index ed94927..beef81e 100644 (file)
@@ -1310,6 +1310,10 @@ int  swf_WriteSWF2(struct writer_t*writer, SWF * swf)     // Writes SWF to file,
       len += swf_WriteTag(-1,t);
       if(t->id == ST_DEFINESPRITE && !swf_IsFolded(t)) inSprite++;
       else if(t->id == ST_END && inSprite) inSprite--;
+      else if(t->id == ST_END && !inSprite) {
+       if(t->prev && t->prev->id!=ST_SHOWFRAME)
+         frameCount++;
+      }
       else if(t->id == ST_SHOWFRAME && !inSprite) frameCount++;
       t = swf_NextTag(t);
   }