0

我有一个 swf 对象,我想使用 COM Shockwave Flash Object 控件嵌入它。我四处搜索,但我只找到了涉及使用文件或互联网 URL 的答案。当我使用一键发布方法时,我想有一种方法可以将我的 flash 对象作为资源文件嵌入到我的应用程序中。

谢谢,

马特

4

1 回答 1

0

我过去做过类似的事情,但从数据库表而不是资源加载

Swf 是表单上的一个 AxShockwaveFlash 对象,用于显示 flash 项。

如果您将资源添加为 .swf 并将 FileType 设置为二进制,则它应该将其作为字节数组返回,然后您可以在 memorystream 构造函数中使用它

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
于 2012-08-01T11:05:05.190 回答