Moving an object as the date changes using Java

Dec 17, 2020

I have inherited a Storyline file that I think uses Java to move a star across a timeline as the date changes. So that is you are viewing the timeline in January you see the star at the start of the timeline, and if you check again in February the star has moved to February, etc. 

I can't figure out how to edit/update the dates because the triggers are a string of numbers and note a calendar date (see attachment). Any ideas?

8 Replies
Dave Cox

Hi Jennifer,

I suspect that your project is using Javascript. (Java is a different language.) 

The Javascript date object returns a number in milliseconds since January 1, 1970, UTC. That may be what those numbers are. It seems odd that someone would use that though, as there are much easier and more readable ways to accomplish that task. 

To be much help to you however, I would really need to see the code in your project, which I can't do from the PNG that you sent. Would it be possible for you to post the .story of your project here?

If you don't want to share it publicly, you could PM me, and I can provide you with an alternate way that you could send it to just me. I assure you that no one else will see anything that you share with in private.

Dave

Jennifer Rogers

Hi Dave, I would really appreciate that, thank you. I'm attaching the .story file

I have been trying to use the javascript calculation to update the values, and have alternatively tried creating an epoch variable instead and have not had success. 

As you can see I am trying to get the star place marker to appear when dates are between two time periods. I wasn't sure how to PM you separately so I hope you are receive a notification.

Math Notermans

Fixed it...and added a test version in which you can change the month to see it works.

3 versions...
MN1 is as yours with all the code you had in added. A lot of that code was unneccessary in my opinion as you only needed to know the actual month. Kept it as is, because i might have missed some requirement for which you needed all the date info.

MN2 in this version i cleaned up the code and made sure it still worked properly. You can change the input field from 12 to 1,2,3 etc. to see the changing months.

MN3 i removed those inputfields and this one ( if working as planned ) you can publish and put live.

Jennifer Rogers

Thanks for looking at this and for the new versions. This seems like a good solution to simplify the timeline and have the star move based on the month, I think my predecessor had it move every 10-15 days so was trying to get more exact dates.

When I 'publish to web' to check functionality in MN2 and MN3, the red stars appear on every month at the same time, the stars on non-current months aren't hidden.

Math Notermans

Let me doublecheck and fix that ;-) 

What browser ? Because in Chrome i dont have that....
And just tested a published version in IE, FF and Edge...all work properly...so im not sure how you are testing...

I did change some publish settings. Removing Flash fallback and setting it to pure HTML5..
Here you see it works properly... 
https://360.articulate.com/review/content/46d11c17-cea8-43e1-af2b-0cfb9d0db53a/review

Is Javascript enabled in your browser ? That is needed offcourse ?