This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Afnizar Nur Ghifari
Posted Aug 15 - Read on Facebook

Hi guys, I'm trying to add events to looped sublayers, the first 'this.children[0].animate' work but after I put it on Utils.delay shown error 'TypeError: undefined is not an object'.

Anyone knows how this happens and how to fix this error? 🤔

Thanks!

2 Comments

Arie Aulia Nugraha

Have you tried using "delay" as part of options for this.children[0]?

Eelco Lempsink

Good that you manage to fix it! Let me try and explain a bit more about what you ran into. The problem is that `this` can mean different things in each function (after an arrow).

In your case: the first one will be the same as `image` (because that’s what you tap). The second one, after the `Utils.delay` will not be image, but `window`.

There are a couple ways to fix this: you could use `image` instead of `this`, but that only works if you have only one image. A better fix is to use the double arrow (=>) instead of the single one (->) when using Utils.delay. That makes sure that `this` stays the same.

Read the entire post on Facebook