Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Embedding SWF in Django
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
I'm using PythonAnywhere to try to host a site for my mod, Float. I can't get the SWF to display though. I'm just embedding this in a template:
In the same directory, I have Scratch.swf (can't rename fsr), swfobject.js, and ExpressInstall.swf.
Anything I'm doing wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Float- Beta</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> swfobject.registerObject("myId", "9.0.0", "expressInstall.swf"); </script> </head> <body> <div> <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="140"> <param name="movie" value="Scratch.swf" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="Scratch.swf" width="300" height="140"> <!--<![endif]--> <div> <h1>Whoops!</h1> <p>It looks like you don't have Flash Player. <a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p> </div> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> </body> </html>
In the same directory, I have Scratch.swf (can't rename fsr), swfobject.js, and ExpressInstall.swf.
Anything I'm doing wrong?
Last edited by davidkt (June 19, 2014 21:30:31)
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
bump
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- blob8108
- Scratcher
1000+ posts
Embedding SWF in Django
I don't understand why embedding a SWF in an HTML page is in any way specific to Django. The code you've posted is just a static HTML file. Does it work if you serve the file with a normal HTTP server (`python3 -m http.server`)? Have you misconfigured Django's static directory? (Does the SWF 404?)
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
If I `python3 -m http.server` it gives a timeout. I don't think I have the static directory misconfigured. And I can't tell if the SWF 404'd. It just shows a blank screen. I don't understand why embedding a SWF in an HTML page is in any way specific to Django. The code you've posted is just a static HTML file. Does it work if you serve the file with a normal HTTP server (`python3 -m http.server`)? Have you misconfigured Django's static directory? (Does the SWF 404?)
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
Timeout.What happens when you visit the URL of Scratch.swf? And I can't tell if the SWF 404'd.
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
No, it does a timeout when I use `python3 -m http.server`. I don't know how to make a URLconf for a SWF.Well, there's your problem, then. Timeout.
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
Urls:
With Django:
http://floatprogramming.pythonanywhere.com/beta/
With http.server:
http://floatprogramming.pythonanywhere.com:8000/float/templates/Scratch.swf
With Django:
http://floatprogramming.pythonanywhere.com/beta/
With http.server:
http://floatprogramming.pythonanywhere.com:8000/float/templates/Scratch.swf
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- j90009000
- New to Scratch
40 posts
Embedding SWF in Django
In the same directory, I have Scratch.swf (can't rename fsr), swfobject.js, and ExpressInstall.swf.
Anything I'm doing wrong?
Yes, you are forgetting the flashvar to include the sb2 file.
Read more here: http://scratch.mit.edu/discuss/topic/42691/
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
Okay, I'll try that. Thanks!In the same directory, I have Scratch.swf (can't rename fsr), swfobject.js, and ExpressInstall.swf.
Anything I'm doing wrong?
Yes, you are forgetting the flashvar to include the sb2 file.
Read more here: http://scratch.mit.edu/discuss/topic/42691/
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
Nope, doesn't work.Okay, I'll try that. Thanks!In the same directory, I have Scratch.swf (can't rename fsr), swfobject.js, and ExpressInstall.swf.
Anything I'm doing wrong?
Yes, you are forgetting the flashvar to include the sb2 file.
Read more here: http://scratch.mit.edu/discuss/topic/42691/
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
Ok, I got the SWF to display, but it doesn't default to the editor and I can't get it into the editor. You can see here.
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
In other words, how do you set the parameters for a direct application/x-shockwave-flash mimetype request in Django?
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- DigiTechs
- Scratcher
500+ posts
Embedding SWF in Django
Like you would normally, <object> tags and <parameter> tags.
I do, in fact, have my own site; it's here.
I'm also working on a thing called Fetch. Look at it here!
@thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain. @thisandagain pls explain.
- j90009000
- New to Scratch
40 posts
Embedding SWF in Django
here.Ok, I got the SWF to display, but it doesn't default to the editor and I can't get it into the editor. You can see
Hi David, I just struggled with the same problem. You forgot to add a flashvar parameter and upload the sb2 file as well.
So add a param like this:
<param name=“flashvars” value=“project=the_name_of_your_scratch_project.sb2”>
But, that will only play the app, not put it into editor mode. I think that's another flashvar, but I don't know all of them – I had to use firebug just to find out some of the existing ones. You'll need to see what params are sent to the scratch.swf file to put it into editor mode. Then I'm not sure how it persists the sb2 file. I just use the offline editor to create the sb2 files.
Ah, you are trying to allow users to edit and save the sb2 files on your server. I have no idea how to do that.
Last edited by j90009000 (June 23, 2014 02:34:49)
- djdolphin
- Scratcher
1000+ posts
Embedding SWF in Django
In Scratch.as, you can set it to start in edit mode somewhere.
!
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
I said Like you would normally, <object> tags and <parameter> tags.direct application/x-shockwave-flash mimetype request, not HTML.
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
I know it has to do with a flashvar, but I'm not sure how to set flashvars in a django.http.HttpRequest object.
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- davidkt
- Scratcher
1000+ posts
Embedding SWF in Django
Well, I copied the whole page from http://scratch.mit.edu/create/ (logging out first), and put my SWF in rather than the Scratch one, but it doesn't load. Any help? blob?
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- Discussion Forums
- » Advanced Topics
- » Embedding SWF in Django