I want to be able to call an external js function

For developers using the Construct 2 Javascript SDK

Post » Mon May 30, 2016 11:30 pm

Hi,

I'm sure this must have been covered at some stage . I just can't seem to find the right tutorial/forum post.
I have an external js file that is in my plugins folder. I am trying to call to a function in it using this in an expression.
var learnername = (scorm.get("cmi.core.student_name"));

But I just get an error saying scorm.get is not a function. Yet I know that it is a function of my external.js file.

Any ideas?

Cheers
Luke
B
10
S
2
Posts: 50
Reputation: 1,100

Post » Mon May 30, 2016 11:38 pm

Have you included the dependency in GetPluginSettings():

"dependency": "external.js",
ImageImageImage
B
71
S
22
G
249
Posts: 3,763
Reputation: 138,577

Post » Tue May 31, 2016 12:32 am

Hey blackhornet,

Does this go into the runtime or edittime?
B
10
S
2
Posts: 50
Reputation: 1,100

Post » Tue May 31, 2016 12:57 am

OK yes I do have this in the edittime.js

"dependency": "SCORM_API_wrapper.js",

Should I put in all variables from this also?
B
10
S
2
Posts: 50
Reputation: 1,100

Post » Tue May 31, 2016 1:25 am

You can use Multiplayer as an example. It includes four different external files.
ImageImageImage
B
71
S
22
G
249
Posts: 3,763
Reputation: 138,577


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests