goToTimeInTimelineNamed - How does it work?

I would like to jump to a specific time in a persistent symbol.

I have tried this but not luck… please can someone help?

hypeDocument.getSymbolInstanceById('game').goToTimeInTimelineNamed(00:04.7, 'Main Timeline');

Thank you!

This might help…

Thank Michael, but it unfortunately did not help :frowning:

Is there no simple way to say gotoAndPlay a specific time in a symbol…
When I say specific I mean something like 00:04.7 not, 1 2 3 e.t.c

Would be so much easier if there were frame labels :frowning:

1 Like

The time in the API is a javascript number value in seconds, so if you want the Hype timecode of 00:04.7 you would use 4 + (7/30) as the frame number is in 30fps. Alternatively you can do the math ahead of time and then supply the value of 4.2333.

Beyond this your code should work.

1 Like

Yes!!!

1 Like

gotoAndPlay("hypeRocks"); :slight_smile:

also

1 Like

Thanks Jonathan! Although using 4.2333 was hit and miss… sometimes it stops, sometimes it does not. @ MaxZieb solution seems to be more reliable.

To be fair @jonathan had it right! … the conversion offers more options like number, object or string input etc. but the math boils down to return min*60+sec+frm/FPS; with the focus being sec+frm/FPS

Little Explanation:
The reliability might result from passing a literal number or an math expression into the time argument. The extension passes a high precision number … just using 4.2333 with 4 digits behind the 0 is not as precise as 4 + 7/30 as that is actually an irrational number that has infinit digits.

Wishlist for Hype 4 (or 4.x)
hypeDocument.goToLabelInTimelineNamed(‚MyLabel’, ‚Main Timeline’)

2 Likes

The playing state is independent of the playhead position, so if you need it to start or stop you need to explicitly call the hypeDocument.pauseTimelineNamed() or hypeDocument.continueTimelineNamed() APIs.

Looks cool, given the current design I think something like this might be better…

Rename Timeline Actions to Timeline Options. Clicking the + button brings up the same window with an extra Timeline label option.

2 Likes

Having labels was a keystone in Flash. People used them to get into programming using the timeline like linenumbers in good old BASIC-Programming to jump back and forth in execution logic and order. It’s easy to grasp … but it has the potential to become “Spagetti-Code” very quick. That said …

The idea I had in mind when making the mock up was based on the approach to keep actions and labels conceptually separate… as labels are great for accessing/adressing portions in animation and directing flow (stop, loops, sync of function calls to animation). But I think that complex programming in this manner should be discouraged or at least not reinforced in the interface (with labels and actions being the same kind of icon and shared placement).

Hope you understand where I am coming from.

I get where you are coming however timeline actions and timeline labels are inseparable as they both point to a very specific point on any timeline.

I believe Hype is first and foremost a visual animation tool rather that a complex programming tool and as such being able to visually label points in time is a feature sorely lacking.

1 Like

Sure! I am with you on the labels just not on the positioning but either way they will be much appreciated! :wink:

Thanks all for the mockups! :smile:.