Forum Moderators: open

Message Too Old, No Replies

Embedded Flash / Javascript and Binary String. A Challengin question

how to use JS to display a .swf file in base64 string forum

         

coolclu3

10:53 am on Nov 21, 2007 (gmt 0)

10+ Year Member



Hi everybody,
I have a problem that's really causing me the headache here.
Here is the requirement:

1. Use javascript & SOAP to call a webservice
2. This webservice will return a .swf file in base64 String format
3. I need to display this data into browser. In other words, I need to embed this flash data somehow....
Additional requirement: Everything has to be done in a simple (local) .html file, There should be absolutely no websever involed in the *client* side.

1 and 2 are done, and what i receive is a base64 String. What I have now is only Javascript and maybe Shockwave Flash.

There are 2 options that I can do

1. Save the base64 String into a .swf file. *IF* this can be done, embedding the .swf data to browser is of course no problem

But JS has a lot of problems with reading/writing binary files. Moreover, it seems only IE has some support for this, Firefox seems like a little hope. So i now think of solution 2.
2. I know nothing about Flash. But i'm hoping that there are someway that Flash Plugin Engine is intelligent enough to write the base65 binary data directly into the embedded part of the browser.

Please, webmasters, tell me how to attack this problem?

Thank you for reading

vincevincevince

12:02 pm on Nov 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The data URI scheme [ietf.org] would do what you want; unfortunately support is non-existent in Internet Explorer.

My method would be to have your server talk to the other server, get the swf, and deliver it to the client as a standard file. If you want to do it by AJAX or similar, have it deliver an embed element (<embed...) which points to a location on your server where the .swf will be streamed down.

coolclu3

2:56 pm on Nov 21, 2007 (gmt 0)

10+ Year Member



Thanks vince*3 ;) for your quick reply

The data URL scheme is interesting, i've read it, but haven't found out what the status of this RFC yet....Googling....Also, it seems it's only appropriate for "short" data.

The server is currently *only* offering a webservice, so if I understood your method correctly, saving the .swf at the server and returning only the URL to client is not a choice in this case. Of course, it would be much better I agree.

coolclu3

4:29 am on Nov 22, 2007 (gmt 0)

10+ Year Member



I have tried data URL with no success with <Object>. I have seen data URL used in image tag.
Can anyone with more experience please tell me an example?

Or any other workaround, everyone?

Now i'm going to post a thread in Javascript subforum, hoping there will be some nice way to write binary files to local disk...