September 19, 2017 at 3:32 pm #371449
I’ve been trying to connect my variables to a external js sheet, that’ll change their value.
But everything i’ve tried so far, leaves the variable as doesn’t exist, but it exist in the Lectora project.
returns nothing.September 19, 2017 at 5:52 pm #371454
Are you saying, I should have a action on the opening page that says something like
On pageShow > Modify Variable > VariableA = VariableASeptember 20, 2017 at 8:38 am #371513
if the code is apart of the lectora export, it seems to work.
But I’m using an external js, so i can add edit to it without having to re-export. It doesn’t seem to work. I keep getting it’s not a function in the console.log
Is there some special lectora command that needs to be added to it to help make it work?
I know captivate needs a special command to get access to their program’s function, maybe lectora does too?September 20, 2017 at 12:06 pm #371574
I think I understand what you want. Check out this example. In it I have added a link to an external script that I use to hold a variable. You can edit the external script and change the value of the variable without having to re-export the lesson.
One thing to note. I used ‘bottom of file scripting’ to link to the external script. The Trivantis application developers have this incorrect as it places what you link in this way AFTER the closing HTML tag. The only reason why it works is because modern browsers do a very good job at working with broken, bad HMTL. Bottom of file scripting SHOULD put the script just BEFORE the closing BODY tag.
Also keep in mind that if you go this route, you’ll have to manually place the external JS file in the right location in the exported files. My attachment includes the file main.js. This is the external JS file that I put there after the export.
Regarding what I posted earlier. Normally, you need to in some way use a Lectora variable (to initialize it) before you can use it with JS. You’re onPageShow action would do the trick.
Attachments:September 20, 2017 at 12:07 pm #371578
If you post what you have I’ll take a look at it.
You must be logged in to reply to this topic.