I've no idea about how to do it with code. But you can take a free try of PDFmate's free PDF to swf converter. It can help you do it for free: www.pdfmate.com/free-pdf-to-swf-converter.html
I had ever converted my PDF to SWF ebook by using
this pdf to swf, you may also try.