pipwerks / scorm-api-wrapper

The pipwerks SCORM API Wrapper
http://pipwerks.com
357 stars 125 forks source link

Get files from the sco package #4

Closed zabojad closed 11 years ago

zabojad commented 11 years ago

Hi !

I've just started to try the pipwerks scorm api wrapper and I'm facing the following problem: when we have additionnal files (pdf, pps...) packed in our sco along with our swf sco file, how can we "http get" them from our as3 app ?

I've declared several files in the sco package manifest (and included them in the sco package zip) but I don't see how can I fetch them from my as3 code...

Thanks

Tom

moloko commented 11 years ago

I see you've already posted in the Google Group (and I've replied!) - which is the better place for questions like this. This is really for logging bugs with swfobject.

zabojad commented 11 years ago

Sorry for the double post...

Maybe you could add to this lib a function returning the sco absolute path ? That could be useful for others maybe...

Here is what I've added:

on the js side:

    // note: I've done it through innerHTML 'cause on some old versions of IE, it's the only way which works (otherwise it's the relative url which is returned)...
    pipwerks.SCORM.getUrl = function(url) {
        var el= document.createElement('div');
        el.innerHTML= '<a href="'+url+'">x</a>';
        return el.firstChild.href;
    };

And on the AS side:

    private function __getUrl(url:String):String {

        return String(ExternalInterface.call("pipwerks.SCORM.getUrl", url));
    }
pipwerks commented 11 years ago

Hi Tom

This SCORM wrapper is only concerned with the SCORM API. Your scenario is not really a SCORM issue, it's an ActionScript and file management issue.

You can fetch the URL for the current document via standard ActionScript. See the following links:

You should be able to work out the paths to your other files (such as PDFs) from here. No modification to the SCORM code required.