Author Topic: Flash, SWF . call via Include ?  (Read 1406 times)

0 Members and 1 Guest are viewing this topic.

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 261
  • Karma: 18
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Flash, SWF . call via Include ?
« 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:
Code: [Select]
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

Code: [Select]
  swftool:
  IncludeBinary "gfx\chrome5.swf"

but how is it possible to send it now to a WebGadget?

any ideas?
something like this?? :
Code: [Select]
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.
« Last Edit: March 22, 2016 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 978
  • Karma: 258
    • View Profile
Re: Flash, SWF . call via Include ?
« Reply #1 on: March 22, 2016 »
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 I did it sorta like that:

Code: [Select]

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.
« Last Edit: March 22, 2016 by padman »
Challenge Trophies Won:

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 261
  • Karma: 18
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Flash, SWF . call via Include ?
« Reply #2 on: March 22, 2016 »
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
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 978
  • Karma: 258
    • View Profile
Re: Flash, SWF . call via Include ?
« Reply #3 on: March 22, 2016 »
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:
« Last Edit: March 22, 2016 by padman »
Challenge Trophies Won:

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 261
  • Karma: 18
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Flash, SWF . call via Include ?
« Reply #4 on: March 22, 2016 »
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
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Dr.Death

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 433
  • Karma: 8
    • View Profile
Re: Flash, SWF . call via Include ?
« Reply #5 on: March 24, 2016 »
I remember this tool mate. Can you save your finished work??
Proud member of DAWN

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 261
  • Karma: 18
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Flash, SWF . call via Include ?
« Reply #6 on: March 25, 2016 »
Hi mate,  yes all is working now. Will finish the tool and provide it later.
Shouts
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage