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("3.wav","rb"), SWF_SOUND_22KHZ|SWF_SOUND_16BITS|SWF_SOUND_MONO); // create circle shape $circleshape=new SWFShape(); $circleshape->setRightFill(255,255,0); $circleshape->drawcircle(20); // create SWFSprite $sp = new SWFSprite(); // add circle shape $f1 = $sp->add($circleshape); // add sound object $soundinstance=$sp->startSound($soundobject); // customise the playback of the instance // set small loop in point just to prevent "clicks" $soundinstance->loopinpoint(5 *100); // loop sound 999 times $soundinstance->loopcount(999); // after adding content to a *sprite* this *is* always required $sp->nextFrame(); // add sprite to movie $f1=$movie->add($sp); // name sprite for actionscript reference $f1->setName("snd"); // move it to center of screen $f1->moveto(275,200); // write some actionscript $strAction=<<add(new SWFAction($strAction)); // not always required for *movie* in php but... $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... // set compression this time reduces file size from 57k -> 42k echo round($movie->save("$filename.swf",9)/1024)." Kb"; ?>