Thomas James Thorstensson Posted October 5, 2022 Posted October 5, 2022 Hello fellow Greensockers! Here is my little question. I'm calling an instance method of a Typescript class from my class Banner.ts .call(this.imageTiler.doFadeOut,[1], 3); In ImageTiler class I have doFadeOut(imgIndex) { this.tileCreatorArr[imgIndex-1].doFadeOut(); } Now of course, ''this" in ImageTiler will refer to the Tween I'm calling from in Banner.ts, so the tileCreatorArr is undefined. How do I best bind this up so that I can call doFadeOut and get this to refer to ImageTiler class ? Thanks in Advance ? "S"
Solution Thomas James Thorstensson Posted October 5, 2022 Author Solution Posted October 5, 2022 44 minutes ago, Thomas James Thorstensson said: Hello fellow Greensockers! Here is my little question. I'm calling an instance method of a Typescript class from my class Banner.ts .call(this.imageTiler.doFadeOut,[1], 3); In ImageTiler class I have doFadeOut(imgIndex) { this.tileCreatorArr[imgIndex-1].doFadeOut(); } Now of course, ''this" in ImageTiler will refer to the Tween I'm calling from in Banner.ts, so the tileCreatorArr is undefined. How do I best bind this up so that I can call doFadeOut and get this to refer to ImageTiler class ? Thanks in Advance ? "S" Replying to myself here as I found the solution I think. The below works ? .call(() => { this.imageTiler.doFadeOut(1) //Call the fit function again as action box size is variable and brand area may have been re-sized/hidden },[1], 3) 1
Rodrigo Posted October 5, 2022 Posted October 5, 2022 Hi, Great to hear that you got it working and thanks for sharing your solution! ? Hopefully more users will benefit from this. Happy Tweening! 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now