Flash module add-on: Any solutions to avoid --click to activate flash???

Flash module add-on: Any solutions to avoid --click to activate flash???

by jimmy kent -
Number of replies: 4
Hi it is a common problem and an absolute pain that users have to flick on swf files to activate them. Now if it was not moodle, there are many workarounds to this problem, by using some javascript and referring back to a javascript file. But hoe to achieve the same with moodle. Should the javascript file have an absolute reference and what about the html editor stripping the javascript. Thanks in advance for any help.
Average of ratings: -
In reply to jimmy kent

Re: Flash module add-on: Any solutions to avoid --click to activate flash???

by Tom Cox -

Hi Jimmy,

I tried out a javascript solution that works on our 1.7 site at least in a course description. Making this kind of thing work with the flash quiz activity module would be a different story I'm sure. In the description I put:

<script src="http://somesite.com/fooIndex.js" type="text/javascript"></script>
<script type="text/javascript">RunFoo();</script>

and fooIndex.js looks like:

 function RunFoo()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="171" height="100">\n');
   document.write('<param name="movie" value="\n'">http://somesite.com/courseFlash/acti.swf">\n');
   document.write('<param name="quality" value="high">\n');
   document.write('<embed src="http://somesite.com/courseFlash/acti.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="171" height="100"></embed>\n');
   document.write('</object>\n');
}

Tom

In reply to Tom Cox

Re: Flash module add-on: Any solutions to avoid --click to activate flash???

by jimmy kent -
Dear Tom
Many thanks for your help. Since I embed my swf files using <object> tags I am still a bit confused about the following:
Where should I upload the fooindes.js file.

And should I type this script <script src="http://somesite.com/fooIndex.js" type="text/javascript"></script>
<script type="text/javascript">RunFoo();</script>

before the object tags (where i embed my swf)

Cheers
Jimmy

In reply to jimmy kent

Re: Flash module add-on: Any solutions to avoid --click to activate flash???

by Tom Cox -

Hi Jimmy,

You could put the fooindex.js file anywhere really. You just make the code you put in the editor reflect it's location:

<script src="http://somesite.com/anywhere/fooIndex.js" type="text/javascript"></script>
<script type="text/javascript">RunFoo();</script>

and then fooindex.js has all of the object/embed code. For some reason calling a function with the document.write and object tag fakes out IE:

function RunFoo()
{
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="171" height="100">\n');
   document.write('<param name="movie" value="\n'">http://somesite.com/courseFlash/acti.swf">\n');
   document.write('<param name="quality" value="high">\n');
   document.write('<embed src="http://somesite.com/courseFlash/acti.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="171" height="100"></embed>\n');
   document.write('</object>\n');
}

Hope it helps. I'm sure there are some more sophisticated ways of doing it and probably more "relative" ways. You could also have a master .js file that had all the flash for your site and you just call out the functions. I'll play with it some more. Tom

In reply to Tom Cox

Re: Flash module add-on: Any solutions to avoid --click to activate flash???

by jimmy kent -
That was really helpful Tom. Thanks a million, i will give it a go and let you know if I bump into some problems or in the rarest of occasions, if I can find a better solution. Cheers for your help

Jimmy