setDimension(550,400); // useful for debugging $movie->setBackground(rand(0,0xFF),rand(0,0xFF),rand(0,0xFF)); // create SWFSound object : flags set to audiofile lib "sfinfo" output $soundobject=new SWFSound(fopen("4.wav","rb"), SWF_SOUND_22KHZ|SWF_SOUND_16BITS|SWF_SOUND_MONO); // adding sound object to movie returns SWFSoundInstance $soundinstance=$movie->startSound($soundobject); // which can customise the playback of the instance // loop sound 999 times (we will stop it before it gets to 999) $soundinstance->loopcount(999); // set small loop in point just to prevent "clicks" $soundinstance->loopinpoint(1 *100); // add some frames where sound will loop for($i=0;$i<100;$i++){ $movie->nextframe(); } // stop that sound $movie->stopSound($soundobject); // add some frames where sound will not loop for($i=0;$i<100;$i++){ $movie->nextframe(); } // save swf with same name as filename $filename = basename(__FILE__,".php"); // save the .swf with the same name as the .php file // save and output return movie size in bytes... echo round($movie->save("$filename.swf",9)/1024)." Kb"; ?>