Mouse scroll text inside a symbol

I'm wondering if someone can help me with this.
This probably has been asked and answered before but my "search-fu" leaves me with no answers.

How do you mouse scroll a timeline/text inside a symbol? I have it working outside a symbol but inside... :crazy_face:

symbol_text_scroll.hype.zip (124.6 KB)

Screen-Shot-2020-07-28-at-10.55.47

Works for me. Even inside the symbol... common Web-Browsers (Chrome, Safari, Firefox)

He is talking about the Wheelpart.

In symbols you must use the symbolInstance API and not the hypeDocument API.

2 Likes

Max is right, it's all about the 'wheel part'. :heart:

I went twice through the symbol forum after looking at the documentation for clues how to solve this. I then did a global search for 'symbolInstance', with the (error) console telling me it couldn't find just that, I figured out (Javascript for me is like watching a Picasso painting, I have no idea if I'm looking at the front or side of something), that somehow I needed to define that first (I think?). So I tried some things and this seems to work, but still trows up an minor(?) error.

Could someone please take a look at this and help me out? I'm at the end of my capabilities here.

symbol_text_scroll_2.hype.zip (82.2 KB)

As you've realised symbols have their own API which can be/is used when you need to access any timelines within that particular symbol. When you want to reference the symbol you are not constrained to use "symbolInstance" you can use any naming convention you want

var scrollTextSymbol = hypeDocument.getSymbolInstanceById('mySymbolInstance');
scrollTextSymbol.goToTimeInTimelineNamed(time, 'txt_scroll_2');

for example.

The "minor" error you're getting is because of the first declaration of "time" you are looking for the timeline using "hypeDocument" when you should be using the "symbolInstance" declaration.

var symbolInstance = hypeDocument.getSymbolInstanceById('mySymbolInstance');
var time = symbolInstance.currentTimeInTimelineNamed('txt_scroll_2');

would be the correct syntax.

Here, in your document, "txt_scroll_2" as a timeline only exists within the symbol.

3 Likes

@DBear Thank you for your clear and easy to understand explanation and the for fix.

Very much appreciated! :heart_eyes: