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); // create button shape $buttonshape=new SWFShape(); $buttonshape->setRightFill(255,0,0); $buttonshape->drawcircle(20); // create SWFButton $b = new SWFButton(); $b->addShape($buttonshape,SWFBUTTON_HIT|SWFBUTTON_UP|SWFBUTTON_DOWN|SWFBUTTON_OVER); // add sound object to button mousedown event $soundinstance = $b->addSound($soundobject, SWFBUTTON_MOUSEDOWN); // use returned SWFSoundInstance handle to customise output // where to start looped sound $soundinstance->loopinpoint(1 *100); // where to stop looped sound $soundinstance->loopoutpoint(70 *1000); // prevent multiple instances : to see what this does // comment out next line and double click the button $soundinstance->noMultiple(); // add button to movie $b1=$movie->add($b); $b1->moveto(200,200); // 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... echo round($movie->save("$filename.swf")/1024)." Kb"; ?>