Moodle SWF Activity Module developer preview
OK, this is going to be a very techie post as it’s aimed exclusively at developers who are interested in integrating Flash and Moodle. If you’ve never written a line of computer code, then this article will most probably bore you to death!
What is the SWF Activity Module?
The SWF Activity Module deploys Flash learning applications as activities in Moodle courses. It uses standards compliant XHTML 1.0 Strict embed code and leverages SWFObject 2.2. For Moodle users, especially non-developers, it’s a quick, easy, reliable, and mostly importantly, non-techie method of embedding Flash.
What’s the developer preview?
I’ve just uploaded a two-part installer package to the SWF Activity Module project site on Google Code. The first part, like any other Moodle activity module, performs the installation in Moodle and acts as the user interface. The second part is the Flash Remoting service library which handles communication between Flash and Moodle. The particular implementation of this is AMFPHP. This package is a developer preview. It has not been extensively tested, has not been proven to be stable and is not intended for installation on public servers.
What does it do?
So far, the activity module does the following:
- Installation
- Backup and restore
- Creates and manages SWF Activity Module instances
- Creates and manages grade items in Moodle’s grade book
- Custom grade reports
The Flash Remoting service library does the following:
- Establishes fast, lightweight, powerful two-way communication between Flash learning applications and Moodle
- Handles user authentication, capabilities and permissions
- Allows Flash learning applications to push and retrieve grades and user data in Moodle’s grade book
- Allows Flash learning applications to retrieve user data such as avatars, VoIP client IDs, groups, etc. to facilitate social networking and web communication between learners and teachers
Accurately track learners’ activities while on-line
The custom grade reports are particularly interesting because they provide a much asked for function in Moodle activities, namely tracking the amount of time that learners spend on activities accurately. The problem at the moment is that Moodle can only record the time elapsed between requests sent to the server while learners are using a module. Between server requests, Moodle can’t tell whether a user was studying or if they went for a tea break, either way the elapsed time logged is the same. Since Flash learning applications run on learners’ computers, they can track mouse, keyboard, camera and microphone actions over any given period of time. If a learner goes for a tea break, mouse, keyboard, camera and microphone actions stop and Flash learning applications can take this into account, for example, by discounting inactive time. I had to create the custom grade reports because Moodle has no provision for this kind of user data.
Open up Moodle to more web services
The SWF Activity Module is far more than we’ve come to expect from Flash based learning interactions. The Flash Remoting gateway opens up Flash and Moodle to a wide range of 3rd party web services. Here’s a few possibilities to consider:
- Deploy web conferencing clients that use open VoIP and chat protocols. Here’s an example of an existing project could be leveraged.
- Deploy Flash clients that leverage Google Wave’s open protocol, when it goes fully public, for real-time multimedia collaborative projects.
- Consume map, video, search and data services from providers such as Google and Yahoo!
- Or any combination of protocols and services for media-rich, collaborative learning interactions. The sky’s the limit.
How can I use the developer preview?
This is where I need your help. I’d like this module to be tested in as many environments as possible except, of course, public servers so if you are a developer and have a development server with Moodle installed, this is where you can help. Installation instructions are included in the developer preview package and the Flash Remoting gateway comes pre-configured for Moodle. There’s also a sample “Grade Pusher” Flash application that simply pushes grades into Moodle’s grade book. Please try it out on your development servers and let me know if you encounter any problems with it.
The SWF Activity Module project site is at: http://code.google.com/p/swf-activity-module/ where you’ll find downloads, documentation, examples, source code and the issues tracker.
The SWF Activity Module is proud to be open-source.

By Vladimir Burcik, February 17, 2010 @ 11:12 am
Dear Matt,
I am using Moodle 1.9.7+. I am successfully installed SWF activity module. But I could not add swf file there. Instead of the button Choose or upload file button I have Drop down box (with text Select a Flash application),
which dont allow me add swf file. What I have to do or where I made mistake?
Thank You for Your help
All the best
Vladimir
By Matt, February 17, 2010 @ 2:00 pm
@Vladimir, Thanks for your interest in the module and for trying it out. I’ve found the problem and fixed it – I had forgotten to change the code back to the standard version before uploading it. You can see this page here on how to switch between file-picker and drop-down list: http://code.google.com/p/swf-activity-module/wiki/CustomiseModuleInstanceForm
The latest installer package has the file-picker set as default: http://code.google.com/p/swf-activity-module/downloads/list
By Kevin, March 10, 2010 @ 12:14 am
Hi Matt.
I’m using the latest module code but I’ve been running in circles. My situation is that I have SWF files output by Captivate. There are two SWF files, one for content, and the other for the skin that controls the content (play, pause, stop, etc.).
How do I specify the skin to use with the SWF_activity module? The help text for the (advanced) Skin parameter says that the parameter is the URL of the skin file, but I don’t see how to specify this URL. The parameter I see is a dropdown list showing the default skins provided by your module which do not work with my SWF file.
Bottom line is that I just want a container that lets a user start and stop the SWF file, but when I upload a SWF file using your module, or the media filter approach in Moodle, all I get is the content SWF file running from start to finish when the page is displayed, and no way to stop it.
Grateful for any pointers.
By Matt, March 11, 2010 @ 1:36 am
Hi Kevin, the SWF Activity Module doesn’t work with multiple files published by Captivate. Captivate CS4 publishes to a single file wherever possible. The problem is that, in the published Captivate directory, the loader files are hard coded to look for files to load in the same directory. AFAIK, there isn’t any way around this. In this case, you can deploy the entire Captivate directory as a resource in Moodle by linking to the published HTML page.
I hope this helps.
By Steve W, June 29, 2010 @ 11:10 am
I am having problems similar to above, I have been given several swf files and I want to link to them from a swf container, I have placed the movies in a seperate folder and have asked the contaier swf file (which resides in the same root folder as the seperate sub folder) to call the individual swf when required, using the loader event in action script. The url used looks something like this:-
mymovies/thismovie.swf
but they do not seem to load, can you please advise.
By Matt, June 29, 2010 @ 1:41 pm
Hi Steve,
Moodle has a recommended way of handling media files for courses that the SWF Activity Module follows. See this page for more information: http://code.google.com/p/swf-activity-module/wiki/AccessingMoodledataFiles
You can use an XML file (xmlurl) to refer to the external SWFs or you can link to them directly, if there’s only one or two with custom FlashVars: http://code.google.com/p/swf-activity-module/wiki/FlashVars
In future, please post questions like this in the project site issues tracker: http://code.google.com/p/swf-activity-module/issues/list
I hope this helps!