SCORM

 
 
Picture of s sta
Closing a flash scorm player window
 

Hi, I'm trying to close the scorm player popup window for a flash (as3) based scorm course, using a button within flash.

Before moodle 2 I used to use the following code, which no longer seems to work:

var jscommand:String = "window.opener.location='http://www.econstruct.co.uk/courses/';self.close();"; 
var req:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");
navigateToURL(req, "_self");

Any ideas on how to fix this please?

 
Average of ratings: -
Picture of Dan Marsden
Re: Closing a flash scorm player window
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators

Content is loaded within an iframe - so self.close will try to close the window inside the iframe but that won't work as you want to close the parent frame - do a google search for info on how to close a window with javascript but include the term "iframe" in your search - it should pull up a range of ways to do it.

 
Average of ratings: -
Picture of s sta
Re: Closing a flash scorm player window
 

Thanks for the reply Dan; spent a good hour searching Google - didn't find anything that worked correctly - do you know of anything that works?

 
Average of ratings: -
Picture of Dan Marsden
Re: Closing a flash scorm player window
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators

try something like top.close instead of self.close - do a search for top.close to see examples.

 
Average of ratings: -
Picture of s sta
Re: Closing a flash scorm player window
 

Thanks Dan, having a go with External Interface calls; will let you know if it works.

 
Average of ratings: -
Picture of s sta
Re: Closing a flash scorm player window
 

Wow I really just can't get this to work at all! Someone must have done this already!?

 
Average of ratings: -
Picture of s sta
Re: Closing a flash scorm player window
 

Hi Dan,  would something like this not work? http://moodle.org/mod/forum/discuss.php?d=200823

 
Average of ratings: -
Picture of Dan Marsden
Re: Closing a flash scorm player window
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators

not sure why you're asking? - have you tried it? smile

 
Average of ratings: -
Picture of s sta
Re: Closing a flash scorm player window
 

Hi Dan,

Finally got around to trying it and doesn't work. Have just spent a few more hours trying other things but nothing seems to work! Have you seen this working from Flash? Do you have any other ideas please?

 
Average of ratings: -
Picture of Dan Marsden
Re: Closing a flash scorm player window
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators

I don't create SCORM packages myself so if those don't work I don't have any other suggestions at this stage sorry - perhaps someone else here might be able to help.

 
Average of ratings: -
Picture of s sta
Re: Closing a flash scorm player window
 

Hi, I'm still no closer to fixing this issue; anybody out there encountered anything similar?

 
Average of ratings: -
Picture of Dan Marsden
Re: Closing a flash scorm player window
Group DevelopersGroup Moodle Course Creator Certificate holdersGroup Particularly helpful MoodlersGroup Translators

There is someone in the tracker suggesting the use of <object> instead of the invalid xhtml <iframe> tag might be part of the issue see MDL-33677 for the details.

I have to admit I'm not feeling overly motivated to spend any volunteer time on that particular bug - it's likely to be quite time consuming and will have to be tested against multiple browsers. simply replacing it with the suggested patch isn't really viable either as I suspect it will make a lot more browsers load the non-compliant iframe tag and that particular code really needs tidying up/rewriting.

 
Average of ratings: -
Picture of SpookieUkie Shmi
Re: Closing a flash scorm player window
 

Any luck for a solution? This is a pretty big problem sad

 
Average of ratings: -
Picture of Jarred Armstrong
Re: Closing a flash scorm player window
 

A work-around which has worked for me comes from another thread.

https://moodle.org/mod/forum/discuss.php?d=192750

Here is the solution:

Create an html file that only contains that short html/javascript code:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript" language="JavaScript">
parent.close();
</script>

</body>
</html>

Let's name this file 'close.htm' for instance.

In Captivate, link a button to this 'close.htm' file, set the URL to open in 'parent'. Don't forget to manually add the 'close.htm' file to the .zip SCORM package prior upload on Moodle.
Tested ok in FF, II and Chrome.

In flash this would just be a getURL call to your close.htm document

 
Average of ratings: -