Mega Code Archive

 
Categories / Delphi / Files
 

How to insert a .swf Flash file into your program

Title: How to insert a *.swf Flash file into your program? Question: Ever wondered, how can you make your program play a *.swf file? Well then you're reading the right article! ;-] Answer: Here is a nice and easy example: uses ShockwaveFlashObjects_TLB; { If you haven't installed this component yet, go to: Component - Import ActiveX Control.. - ShockwaveFlash [ install.. ] } procedure TForm1.FormCreate(Sender: TObject); begin Flash := TShockwaveFlash.Create(self); Flash.Parent := Form1; Flash.Movie := 'c:\flashdelphi.swf'; end; procedure TForm1.FormDestroy(Sender: TObject); begin Flash.Free; end; procedure TForm1.Button1Click(Sender: TObject); begin Flash.GotoFrame(1); Flash.Play; end; That's it. I tested it on Delphi v7 and Delphi v6. Delphi v7 did good, but v6 was quite mean. I don't know, maybe it works even on Delphi v5. Test it.