trial Posted August 11, 2018 Share Posted August 11, 2018 in Animate CC, how do I make a global fadeOut function? In my canvas I have a Square and a Circle movieclip acting as buttons. I want to be able to click on each and have them fadeOut. Instead of writing the fadeOut code individually, is it possible to just usea global function? I don't really know what I'm doing. Found Adobe's page about Convert your ActionScript code to HTML5. I tried my hand at it, but I'm stuck at this: //Square btn this.square_mc.addEventListener("click", square_mcClick.bind(this)); function square_mcClick() { fadeOut(); } // Circle btn this.circle_mc.addEventListener("click", circle_mcClick.bind(this)); function circle_mcClick() { fadeOut(); } // Global fadeOut function function fadeOut() { this.addEventListener('tick', fl_FadeSymbolOut.bind(this)); this.alpha = 1; function fl_FadeSymbolOut() { this.alpha -= 0.01; if (this.alpha <= 1) { this.removeEventListener('tick', fl_FadeSymbolOut.bind(this)); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.