I have a swf object that I would like to embed using the COM Shockwave Flash Object control. I've searched around, but I've only found answers that involve using file or internet URLs. As I am using the One-Click publishing method, I would like to have a way to embed my flash object as a resource file into my application.
Thanks,
Matt
I've done something similar in the past but loading from a DB table rather than a resource
Swf is a AxShockwaveFlash Object on the Form to display the flash item.
If you add your resource as a .swf and set the FileType to binary it should return it as a byte array which you can then use in the memorystream constructor
Using ms As New IO.MemoryStream(my.resources.TheFlashFile), fs As New IO.MemoryStream()
Using bwriter As New IO.BinaryWriter(fs)
' Write length of stream for flash AxHost.State
bwriter.Write(8 + ms.ToArray.Length)
bwriter.Write(&H55665566)
' Length of flash movie file
bwriter.Write(ms.ToArray.Length)
bwriter.Write(ms.ToArray)
fs.Seek(0, IO.SeekOrigin.Begin)
swf.OcxState = New AxHost.State(fs, 1, False, Nothing)
End Using
End Using