Share Posted July 7, 2017 I use Adobe Animate to put my canvases together, not sure if that makes a difference to what I am asking: I have the following code on my main timeline, and it works fine there, with buttons that are also on the main timeline. function buttonOver(theBtn) { thisBtn = theBtn; TweenMax.to(thisBtn, 0.1, { ease: Sine.easeOut, scaleX: 1.05, scaleY: 1.05 }); } However I am having difficulty doing the same thing within a child mc. I have a child clip that contains four buttons that I want to all use this function, and I hope to be able to keep this code within the child clip too, so that it becomes a self contained unit which I can reuse in different projects. I have tried several variations and none have worked. It doesn't necessarily throw an error, just no animation occurs. If I put a console.log in the function it sees and responds to that, it's just ignoring the tweens. I am not sure if it is because the child clip does not know what TweenMax is, or if I am targeting the buttons incorrectly, or something else entirely! Link to comment Share on other sites More sharing options...
Share Posted July 7, 2017 Tough to say without seeing a demo. Please create a very simple demo, zip it, and attach it here. I'm moving this topic to the Banner forum where there are more people familiar with Animate CC and HTML5. This Flash forum is mainly for AS3 stuff (which we don't do much with). Link to comment Share on other sites More sharing options...
Author Share Posted July 7, 2017 I made a simple example demo as you suggested, and on that demo the darn thing worked, even though the code is essentially the same, so there's no need for me to upload it. I'll have to hunt down what the subtle difference is. Thanks! Link to comment Share on other sites More sharing options...
Share Posted July 7, 2017 Can't tell you how many times the same has happened to me. Thanks for letting us know. Good luck on the hunt! Link to comment Share on other sites More sharing options...
Share Posted July 7, 2017 Scope issue likely. Easiest to add this to the main timeline's code and traverse clips starting from there from wherever you are > var root = this; then something like> buttonOver(root.myButtonParentContainer.myButtonChildExample); Link to comment Share on other sites More sharing options...
Author Share Posted July 7, 2017 davi, I use "var root=this" already, manily becauseI find it helps make my code easier to read when I go back to it. However, if I refer to "root" from within a child mc, I get "ReferenceError: root is not defined" in console.log. Link to comment Share on other sites More sharing options...
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