moodle to .swf (flash) communication Share

moodle to .swf (flash) communication Share

by Kyle Egan -
Number of replies: 3

I know this is a real simple script but just thought I would share and maybe find out what others are doing with Flash intergration. Recently we built a Flash game (hangman) and needed to pull in the users name to populate the high scrore table.

So basicly I used an <iframe> to pull in the HTML .swf wrapper (This needs to be converted to .php extention to work). 

We used the following to get the username to the .swf wrapper then used Flash's external interface to grab the userid variable.

<?php
   require('config.php');
   $user=fullname($USER);
?>

<script type="text/javascript">
   userid= "<?php echo $user ?>";
</script>

you would change the config.php location from where the wrapper file sits.

Any other tips for cool flash intergration? I was thinking about using the database activity as the high score table for the next project.

Average of ratings: -
In reply to Kyle Egan

Re: moodle to .swf (flash) communication Share

by Matt Bury -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Kyle,

Which version of Moodle are you using? If it's 1.8 or 1.9, most of the hard work has already been done for you: http://code.google.com/p/swf-activity-module/

It includes an AMFPHP (Flash Remoting) API that exchanges data between Moodle's back end and Flash clients. I have some demos up and running here: http://moodle.matbury.com/course/view.php?id=17 The Word Search application can request its vocabulary data from instances of the Glossary module (experimental). It's very difficult to retrieve the correct IDs for Glossary module instances, so I'll have to develop some kind of interface app that'll list all the Glossary instances on a course with their IDs. It also accepts vocabulary data as XML and FlashVars via the SWF Activity Module instance configuration form.

I'm currently working on an application that queries Forum discussion threads and performs analyses of word frequency, similar to tag clouds, but also allows you to supply XML files of words to omit from the analyses, such as grammatical words (non-content words = a, an, the, then, that, which, be, etc.) so that only content words are counted. It should give learners and teachers an overview of themes running through discussions at a glance. The same can easily be done with chat.

It's also possible to generate games and tests from Glossary entries, so that learners can create glossaries and then use them to generate revision activities.

If you're an intermediate or above Actionscript developer, you could try experimenting with the Snapshot script: http://code.google.com/p/swf-activity-module/wiki/Snapshot There's an example concept map application (open source) that you're free to experiment with, which saves screenshots of Flash apps and records them to the course files directory and links/embeds them in a Moodle grade book entry. I've also got this working for saving short WAV audio recordings from the user's microphone (experimental) but this duplicates what the NanoGong Java app plugin for the Assignment module does. The NanoGong version records audio to MP3 and is much better!

As you can see, there are a variety of ways to use user generated content to generate further activities for revision/review, reflection, consolidation, etc. I think the limit is our imaginations.

BTW, because of Moodle 2.x's new file API, many of these features are impossible to implement without using an externally managed file repository.

I hope this helps! smile

In reply to Matt Bury

Re: moodle to .swf (flash) communication Share

by Kyle Egan -

John, I wasn't aware that there was a games module, I have downloaded it and will have a look.

-------------------------------------------------------------------------------

Matt, thanks for the detailed reply unfortunately I run a 2.2 install - I keep it up-to-date. But I do have an external file repository that I pull my content from. I can see a real need for the work your doing on the MILAs. It's a shame that the 'swf-activity' module doesn't support 2.0+ installs. I also like your idea of a tag cloud form the forums.

So Snap shot is a way for student to prove that they completed an assignment? - by getting a configeration then using the snap shot to send a link to an image to the teacher for grading. If so I can't really think of a time I would use this but interesting none the less.

I haven't considered capturing audio as a deliverable - I understand this must very important for your work in learning and assessing language skills. But now that you have mentioned it, I could probably use this somewhere.  

As a side note because I have a 2.2 install for corporate industry I don't really use the grader functionality - It's all complete / not complete in 2.0+'s Completion tracking. We don't have teachers just managers. smile

 

In reply to Kyle Egan

Re: moodle to .swf (flash) communication Share

by John Andrewartha -

Without wishing to sound rude. Why are you reinventing the wheel?

The games module for Moodle already has hangman and other games, that report to the gradebook.