Jump to content
Search Community

TweenMax within child mc

jwave test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

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

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

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

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>


Link to comment
Share on other sites



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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...