Dark Bit Factory & Gravity
PROGRAMMING => Purebasic => Topic started by: inc. on March 21, 2016
-
Hi at all,
after a while i am stuck on loading a SWF (flash stand alone file) from Memory.
Sure, it is possible to call it like this:
WebGadget(#Webgadget, 2, 268, 1021, 450, "http://www.somesite.net/test.swf")
but what i am try is, include the swf into my EXE File and call it from Mem
swftool:
IncludeBinary "gfx\chrome5.swf"
but how is it possible to send it now to a WebGadget?
any ideas?
something like this?? :
WebGadget(#Webgadget, 2, 268, 1021, 450, ?swftool)
shouts
inc
Attached is my current work while i am calling the swf via url stream, but i wanna make it as a stand alone tool without internet connection needs.
-
Hey,
It's not possible to load SWFs from memory. The only way is to include the SWF in the data section and write it to the temp directory at runtime. In my Flod meets Purebasic thingy (http://www.dbfinteractive.com/forum/index.php?topic=6437.msg83104) I did it sorta like that:
Procedure SWFextract(fileName.s)
If CreateFile(1, fileName) ; create file
L1 = ?swfend - ?swf ; get size of included binary
WriteData(1, ?swf, L1) ; write included binary to file
CloseFile(1) ; close file
EndIf
ProcedureReturn 1
EndProcedure
(...)
temp$ = GetTemporaryDirectory() ; returns the path of the temp directory
SWFextract(temp$+"example.swf") ; extract the file there
(...)
SetGadgetText(0,"file://"+Temp$+"example.swf") ; load the file in the web gadget
(...)
DeleteFile(temp$+"example.swf") ; delete file from temp directory
End
DataSection
swf:
IncludeBinary "swf\example.swf"
swfend:
EndDatsection
Hope this helps.
Pad :)
P.S. Deleted the double posting regarding this problem in the Flod meets Purebasic thread.
-
Thanks for reply and the code snip. I'll try it when i'm back at home.
I found this code in a french Forum. Somehow it seems to be possible :http://www.purebasic.fr/english/viewtopic.php?t=22720
They call an ActiveX and so on. My Problem with this code, I get an error at:FreeMemory(FlashBuffer) ;idem
when i try to compile. I use PB v. 5.30
-
Well, the code in the aformentioned link is from 2006 and doesn't use the web gadget. ActiveX is outdated, too. I stick to it: it's not possible to play SWFs from memory using the current PB version and the web gadget ( until someone proves me wrong of course )
Playing a locally stored SWF file can also fail easily, if Flash isn't configured right on someone's machine btw. Then the web gadget will try to 'download' the SWF file instead of just playing it. All in all the whole SWF thing is not bullet proof. I wouldn't spend too much time on it. ;)
:cheers:
-
back,
thank you for the code sniped.
i use your way to extract an swf from includebin to temp DIR. it's okay to me :)
i also hate this swf stuff, but my mate asked me to include the creator inside a demo tool thing :)
thank you very much for your help.
that should do it. if it fails on some win PC's, so what, who cares ;D
-
I remember this tool mate. Can you save your finished work??
-
Hi mate, yes all is working now. Will finish the tool and provide it later.
Shouts