I was getting very fed up with having to insert Flash content using hand written script in my posts, so I have taken the image module and used it as a start point for a new flash node.
My home page is running some examples at the moment - all the Flash elements on the front page are being generated via the module.
The module lets you choose a Flash file to upload, set its height, width etc. You can also choose whether you want the Flash content to display in the teaser, the body, or both.
It is also using unobtrusive flash objects to insert the code, so it should degrade nicely for older browsers. It also means your page stays standards compliant.
The module code itself is a little bit (ok, quite a bit!) messy as I basically took a copy of image and hacked it. It has had no optimisation yet and there's a lot of stuff that can probably be removed.
The module requires that you create a new table in your database, to store the Flash parameters for the files.
It might be somewhat inelegant internally, but it seems to be doing the job, and I've found it much easier to upload my vague attempts at Flash by using it. Because it borrows from image it also means that if you delete posts then the corresponding Flash file is deleted, which makes for neat housekeeping.
Like I said, some examples here and you want you can download a copy from my site in a zip to have a play with it. But I only finished the first version today so test it first! I also make no apologies for how untidy the code looks internally! There also might be legacy parts of the image that I haven't switched off (although I think I trapped them all!)
And I know I coded it for 4.6 - but that's what I'm using on my site, and I'm very new to Drupal, and my wife's about to have a baby so I daren't try and upgrade the site right now...
Comments
Code tidied up!
I have finished tidying up the code so it is now much cleaner. I have updated the zip on my website to reflect the changes. Links are the same as above!
________
Just five more minutes...
www.stuartandnicola.com
An Alternative tinyMCE + simpleBrowser
Hi Stuart,
If you're just looking for an easy way to insert Flash into your stories and pages, you should look into using tinyMCE to edit your pages. Take tinyMCE, enable the Flash plugin for it, then install simpleBrowser for tinyMCE from
http://tetlaw.id.au/view/blog/fckeditor-file-browser-plugin-for-tinymce-...
This is what I use for putting in Flash content, and it works great. Make sure you use the latest tinyMCE. The actual tinyMCE module hasn't been updated for 4.6 in quite a while, so if you're able to upgrade to 4.7 I'd really recommend that. Otherwise, theme the tinyMCE installation to use the plugins you need (Flash and SimpleBrowser, plus others) and things work pretty well with 4.6.
Nathan Haug
creative graphic design w: quicksketch.org
& software development e: nate@quicksketch.org
Fair point, but...
The logic for writing the node is that it keeps all my Flash material together within the system, so I can easily find my nodes with Flash in!
Also, by using the same idea as image I let Drupal manage the contents of the Flash folder. I always forget which files I loaded, and why, but this way I can use the database to determine what file goes with what node! Delete the node, and the flash goes with it!
Longer term I'm wondering whether it might be possible to write something like img_assist to re-use Flash content in other places, and also to enable the module with block options. But that's a while off yet!
In the meantime I've done some more updates to the code, still posted at my site - links as above - if anyone else wants to try it!
________
Just five more minutes...
www.stuartandnicola.com
Ready for testing!
I've been continuing to work on this as a bit of a project / learning exercise with Drupal. The basic module/node is ready now. It lets you create a node of type flash that has a Flash animation associated with it.
If nothing else it is a lot quicker to load up an animation via this module than to fiddle around with ftp and manually write the javascript! Eg, I have a backlog of old Flash animations that hadn't made it over to my drupal site because it was just too awkward - they're mostly done now!
It also makes it a breeze for people who aren't used to javascript - loading Flash via this module is no different to loading a picture. It even detects the movie size for you if you don't know it.
It also solves the problem of multiple flash elements on one page. If any Flash is detected the ufo.js is attached once, but then multiple nodes can access it. Each flash item is assigned its own id, so they can happily co-exist on the same page. Again, much harder to do by hand.
Feel free to download and test if you want to try it out!
Future development needed: add a block mode, add something like img_assist, add a facility to choose where in the original post the flash appears (at the moment it is always the top).
Feedback welcome / appreciated!
________
Just five more minutes...
www.stuartandnicola.com
Now includes flash filter
I have been doing some more work on this node and it now includes a filter so you can re-use flash content in other places really easily. Details and download here.
________
Just five more minutes...
www.stuartandnicola.com
Flash 4.7 created...
Version created for Drupal 4.7 - info here.
________
Just five more minutes...
www.stuartandnicola.com
Thanks for the update! I am
Thanks for the update! I am planning to use it in one of my projects.
Tecito.com
Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.
Now in the drupal repository
This module is now a Drupal project and is available from the Flash node project page.
________
Just five more minutes...
www.stuartandnicola.com