Flash ActiveX:如何从内存、资源或流加载电影?
我正在我的 C++ 应用程序中嵌入 Flash ActiveX 控件(Flash.ocx、Flash10a.ocx 等,具体取决于您的 Flash 版本)。
我可以通过调用 LoadMovie(0, filename) 加载 SWF 文件,但该文件需要物理驻留在磁盘中。 如何从内存(或资源、或流)加载SWF? 我确信一定有办法,因为像f-in-box这样的商业解决方案的功能直接从内存加载 Flash 影片 也使用 Flash ActiveX 控件。
I'm embedding a Flash ActiveX control in my C++ app (Flash.ocx, Flash10a.ocx, etc depending on your Flash version).
I can load an SWF file by calling LoadMovie(0, filename), but the file needs to physically reside in the disk. How to load the SWF from memory (or resource, or stream)? I'm sure there must be a way, because commercial solutions like f-in-box's feature Load flash movies from memory directly also uses Flash ActiveX control.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
显然我需要提供投票“赞成”的详细信息……好的。
首次初始化时,内部闪存缓冲区指示是否已加载电影或缓冲区是否在缓冲区前四个字节中保存属性。
gUfU——没有加载电影。 要遵循的属性 ....
fUfU -- .. [4bytes] 大小为整数。
然后是未压缩的电影或 SWF。
编写一个 IStream 类。
填写如上。
另存为 szFile
Appearantly I a going to need to supply details for a vote 'up'.. OK.
The internal flash buffer when first initiailized indicates if a movie is loaded or if the buffer hold properties in the buffer fisrt four bytes.
gUfU -- no movie loaded. properties to follow ....
fUfU -- .. [4bytes] size as integer.
then the UNCOMPRESSED movie or SWF as it were.
Write a IStream class.
fill with above.
save as szFile
Things to note :
When psStreamInit->Load(fStream);
will call IStream::Read looking for the header 'fUfU'.
if the return is correct psStreamInit then calls IStream::Read for the buffer size.
If everthing looks good so far, psStreamInit then reads in 1024 byte chunks until the read is exhausted.
However. for the header and file size.
pcbRead is invalid. you may want to use something like
IsBadReadPtr
--
Michael
为了节省您打字的时间。 它以这种方式对我有用(只是没有经过广泛测试):
To spare you some typing. It works for me in this way (just works not extensively tested):
作为一个 Flash 爱好者,我不知道 C++ 端的任何细节,但是如果您在 Flash 端向假协议发出请求,那么在 C 端您可以拦截该请求并用数据流应答它吗? 我的意思是:
只要响应(对于 Flash)看起来像 HTTP 流,就应该可以工作。 (如果“拦截请求并返回数据流”是您寻求帮助的部分,请提前致歉。)
Being a flash guy I don't know any details on the C++ side, but if you made a request on the Flash side to a fake protocol, on the C side can you intercept that request and answer it with a data stream? I mean something like:
As long as the response looks (to Flash) like an HTTP stream, that ought to work. (Apologies in advance if the "intercept the request and return a data stream" is the part you're asking for help with.)
此外....
Flash 播放器推广 IPersistStorage。
flash.QI IPersistStorage
pStorage.load (mystorage_as_stream)
.. 理论上。
对上述内容感到抱歉..我本来打算发帖
Flash播放器提升IPersistStreamInit。
flash.QI IPersistStreamInit
pStream.load (my_stream)
迈克尔
in addition....
Flash player promotes IPersistStorage.
flash.QI IPersistStorage
pStorage.load (mystorage_as_stream)
.. in theory.
Sorry for the above.. I intended to post
Flash player promotes IPersistStreamInit.
flash.QI IPersistStreamInit
pStream.load (my_stream)
Michael
当您尝试通过 MovieclipLoader 或 LoadMovie 从另一部电影加载电影时,此方法不起作用!
结果就是替换了调用的SWF文件!! ...所以此方法仅适用于加载基本文件。
有人知道更好的方法也可以与 MovieClipLoader 和 LoadMovie 一起使用吗?
谢谢。
This method don't work when you try to load a movie via the MovieclipLoader or LoadMovie from another movie!!!
The result is to replace the calling SWF file!! ...so this method work only for loading the base file.
Someone know a better method that work also with MovieClipLoader and LoadMovie?
Thanks.
MS VC ATL 示例(使用 VS 2010 SP1 + Windows SDK 7.1 构建,并在带有 Flash64_11_3_300_257.ocx / Flash32_11_3_300_257.ocx 的 Windows 7 SP1 64 位和带有 Flash32_11_3_300_257.ocx 的 Windows XP SP3 32 位上进行测试):
MS VC ATL sample (have built with VS 2010 SP1 + Windows SDK 7.1 and tested on Windows 7 SP1 64-bit with Flash64_11_3_300_257.ocx / Flash32_11_3_300_257.ocx and on Windows XP SP3 32-bit with Flash32_11_3_300_257.ocx):