goToTimeInTimelineNamed - How does it work?


#1

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!


(𝕄𝕚𝕔𝕙𝕒𝕖𝕝 𝔾𝕒𝕣𝕠𝕗𝕒𝕝𝕠) #2

This might help…


#3

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:


(Jonathan Deutsch) #4

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.


#5

Yes!!!


#6

gotoAndPlay("hypeRocks"); :slight_smile:

also


#7

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


#8

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


#9

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.


#10

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


Timeline markers plus 'Next marker' or 'Previous marker' Actions
(Jonathan Deutsch) #11

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.


#12

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.


#13

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.


#14

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.


#15

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


(Jonathan Deutsch) #16

Thanks all for the mockups! :smile:.