Just curious, as I've never used Java but expect it may be the key, is there any way to put a condition on a button that means it could only be opened on a particular day of the year? I expect it would need to check the PC's settings somehow.
Yes, using JavaScript you can grab the system date and then in Storyline you can compare that date to a value you predefine. If it matches, then you can change the state of your button from hidden (or disabled) to Normal.
You can search the forums for JavaScript examples for getting the date.
Keep in mind that JavaScript only works for published output in Flash and HTML5 formats, not the Articulate Mobile Player/iPad.
Hi Gavin, I was just working on a calendar-related project and remembered your post. To get the date into Storyline, I used the following JavaScript:
var JSdate = new Date(); var JSYear = JSdate.getFullYear(); var JSDOM = JSdate.getDate(); var JSMonth = JSdate.getMonth(); var JSDay = JSdate.getDay(); var player = GetPlayer(); player.SetVar("Year",JSYear); player.SetVar("DOM",JSDOM); player.SetVar("Month",JSMonth); player.SetVar("Day",JSDay);
You can then further manipulate the Storyline variables (in my script: Year, DOM, Month, Day) to create the date format you need. Hope that helps.
Hello I've just used the screenr tutorial and it worked a treat, I'll try yours Michael tomorrow and see if it's the same. I'm going to have to fiddle with it for english date format and start, I think adding lots of true/false variables for when the dates progress, i.e. if 2/12/13 make 1/12/13 and 2/12/2013 True to reveal. Thanks for all your advice everyone - this is my first ever attempt at java!
Gavin, great to hear that you are making progress! As mentioned, I had just completed a calendar-related interaction for a client. I put a short write-up and a sample on my blog here, in case you are interested to see what's possible with the JavaScript I had listed earlier and a bunch of custom variables, states and triggers.
Gavin, I remembered your post about using JavaScript to get the system date and use it in an Advent Calendar. I just finished my own little Advent Calendar project and thought I share a link here: http://dev.keypointlearn.com/xcl71_SL/Christmas2013/story.html
13 Replies
Yes, using JavaScript you can grab the system date and then in Storyline you can compare that date to a value you predefine. If it matches, then you can change the state of your button from hidden (or disabled) to Normal.
You can search the forums for JavaScript examples for getting the date.
Keep in mind that JavaScript only works for published output in Flash and HTML5 formats, not the Articulate Mobile Player/iPad.
Here is some info on using JavaScript in Storyline, including one example that deals with getting the current date.
Hi Gavin! Looks like Steve and Michael have you covered here. Just let us know if you need anything further.
Thank you all I'll give it a go and let you know how I get on
Sounds great Gavin!
Hi Gavin, I was just working on a calendar-related project and remembered your post. To get the date into Storyline, I used the following JavaScript:
var JSdate = new Date();
var JSYear = JSdate.getFullYear();
var JSDOM = JSdate.getDate();
var JSMonth = JSdate.getMonth();
var JSDay = JSdate.getDay();
var player = GetPlayer();
player.SetVar("Year",JSYear);
player.SetVar("DOM",JSDOM);
player.SetVar("Month",JSMonth);
player.SetVar("Day",JSDay);
You can then further manipulate the Storyline variables (in my script: Year, DOM, Month, Day) to create the date format you need. Hope that helps.
Thanks Michael! Even if Gavin does not need it, I'm sure this will prove useful to someone in the community at some point in time
Hello I've just used the screenr tutorial and it worked a treat, I'll try yours Michael tomorrow and see if it's the same. I'm going to have to fiddle with it for english date format and start, I think adding lots of true/false variables for when the dates progress, i.e. if 2/12/13 make 1/12/13 and 2/12/2013 True to reveal. Thanks for all your advice everyone - this is my first ever attempt at java!
Awesome, thanks for the update Gavin
Gavin, great to hear that you are making progress! As mentioned, I had just completed a calendar-related interaction for a client. I put a short write-up and a sample on my blog here, in case you are interested to see what's possible with the JavaScript I had listed earlier and a bunch of custom variables, states and triggers.
Gavin, I remembered your post about using JavaScript to get the system date and use it in an Advent Calendar. I just finished my own little Advent Calendar project and thought I share a link here: http://dev.keypointlearn.com/xcl71_SL/Christmas2013/story.html
Great work, Michael! I really like the overall design and the use of JavaScript to control the doors.
I also like the reminder from Santa to be patient! Thanks for sharing Michael!
This discussion is closed. You can start a new discussion or contact Articulate Support.