Javascript API to change state of Storyline Objects and similar

Mar 04, 2015

Hello

I know how to pick up and pass back variables to a storyline story.

However, I would like to do more sophisticated things e.g. change the state of an object from hidden to normal and similar things (maybe go to a specific layer or slide).

Is there a way of doing that? Or some kind of workaround???

Thank you so much.

Andrew

7 Replies
Andrew Lian

Thank you Matthew. Yes it does make sense and I kind of worked out that this might work - and it does. I guess I had hoped that there would be some built in functions to make it more straightforward and less cumbersome - but I am quite delighted that the "remote control" model that you describe works. Thank you for confirming it.

Andrew

Steve Flowers

Unfortunately, the only things you can pass between the player and the browser (in the Flash-based player) are variables. 

For my remote control variables, I setup number vars with a default of zero. Grabbing the value, incrementing the value, and pushing the variable back into Storyline consistently reflects the change. The side-benefit to the number is you can see how many times your remote has been triggered and easily track in a variable reference. 

Steve Flowers

//for folks that need an illustration or example

var player=GetPlayer();

var rVar1=Number(player.GetVar("rv1"));

rVar1++;

player.SetVar("rv1",rVar);

 

//if you wanted to be funny, you could create a library or function to do this for you

sendRemote=function(ref) {

var player=GetPlayer();

var temp=Number(player.GetVar(ref));

temp++;

player.SetVar(ref, temp);

}

sendRemote("rv1");

setTimeout(function(){sendRemote("rv2");}, 2000);

//Sends remote trigger rv1 then sends rv2 two seconds later.

Andrew Lian

Thank you for the very specific example, Steve. That too is very helpful - especially the library idea and the timing. I have asked another question in the forum that I am sure you can answer in an instant, but no one has responded to it yet (not sure whether it is appropriate to ask it as a followup here but here goes anyway).

I want to use javascript to send back a variable where certain words are colored or otherwise highlighted (specifically strikethrough font). I have tried to change color and effect using simple html tokens like <font color="red"> (properly escaped) - I believe that they should work. But cannot change the color or effect (using <strike>). This has no effect. However, I *have* succeeded in sending <b>, <i> and <u> correctly. Am I doing something wrong? I confess that I am not good at html or css and not quite sure how to build them into javascript usage in articulate.

Thanks again so much.

 

 

 

Christie Pollick

Hi, Rafik -- Thanks for reaching out, and while Steve is a very active member of the community, there is a possibility that he is no longer subscribed to this post, as some time has passed. Unfortunately, I am not equipped to provide JavaScript support, so in the event that you do not hear back from him, please feel free to reach him directly via the 'Contact Me' link on his profile page. :)

This discussion is closed. You can start a new discussion or contact Articulate Support.