You’ll want to declare the name yourself. You can do that in the ‘Timeline Actions’ bit of the main window, running a JavaScript you create. You’ll have to define a new JS for each timeline you want to name.
General form would be something like:
function whateverYouWantToCallIt(hypeDocument, element, event) {
window.currentTimeLine = 'Whatever you want to call it';
}
What this does is populate a global variable, by omitting the ‘var’ keyword prior to the declaration. (The term ‘window’ specifies that the scope of this variable is across the current browser window that contains the Hype document.) This variable will then be accessible from anywhere within your current Hype document.
To find out what that variable contains, you’d access it from anywhere else in your document, maybe with a button action first just to be sure; assign something like this to an onClick event:
function whereAmI(hypeDocument, element, event) {
alert( currentTimeLine );
}
What you’re wanting to do - determine what the current timeline’s name is through JavaScript - is not something Hype allows, as far as I know. You have to put that information into a variable first.
Ha, wow, I was focused on the Global Variable part and didn’t pay attention to the Hype API part. There is a similar api for Scenes (hypeDocument.currentSceneName()), but there is no hypeDocument.currentTimelineName(). Hype supports playing multiple timelines at the same time, so the best we could do is return the list of timelines currently playing (but we don’t).
@warrenao’s solution is your best bet or you could loop through all possible timelines checking hypeDocument.isPlayingTimelineNamed(‘timelineName’).