Comprehensive Javascript tutorial?
Jun 15, 2015
By
Mike B.
I've run through some JS tutorials online, but would like more info on using it in Storyline. The page here contains very little info: http://www.articulate.com/support/storyline/javascript-best-practices-and-examples
My issue is that I have some code that works great in an html document, but I can't figure out how to successfully bring that code over into Storyline.
Are there any tutorials or sample .story files that one would recommend I look at to see how code is typically implemented?
Thanks,
Mike
2 Replies
can you post the code, I am sure someone can chip in a tell you why it isn't working
I did make some progress today, and got part of my code working. Now I'm just trying to make it set a Storyline variable.
Here's my code that works, which embeds a Wistia video into a slide (I've remove the code to my actual video) and pops up an alert when the video completes. This code is within an object "Insert Video from Website":
<script src="http://fast.wistia.net/assets/external/E-v1.js"></script>
<iframe src="http://fast.wistia.net/embed/iframe/CodeForVideo" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="640" height="360"></iframe>
<script type="text/javascript">
wistiaEmbeds.onFind(function(video) {
video.bind("end", function() {
alert("I am an alert box!");
return this.unbind;
});
});
</script>
My altered code below is supposed set my Storyline variable to "on", but my alert doesn't even fire when I have this code embedded:
<script src="http://fast.wistia.net/assets/external/E-v1.js"></script>
<iframe src="http://fast.wistia.net/embed/iframe/CodeForVideo" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="640" height="360"></iframe>
<script type="text/javascript">
wistiaEmbeds.onFind(function(video) {
video.bind("end", function() {
var player = GetPlayer();
alert("I am an alert box!");
player.SetVar("EndofVideo1","on");
return this.unbind;
});
});
</script>
Is there anything obvious that I've done wrong?
Thanks,
Mike
This discussion is closed. You can start a new discussion or contact Articulate Support.