Share Posted June 26, 2013 I have five movieclips, with different instances, since i would want to use them as buttons later with different actions. (let's call them mc_1, mc_2, mc_3, mc_4, and mc_5) Each of this moveclips will share the same tween for movement. Now, here comes the tricky part -for me- : Each movie clip, share a common nested-moviecli. It is the same instance for all of them. Let's call it inner_animation. What i want to do, is to tell each movie clip (mc_1, mc_2 ...) to run inner_anmation once the tween has completed. Here is an example for what i have for mc_1: import com.greensock.TweenLite;import com.greensock.easing.*;TweenLite.to( mc_1, 0.5, {_x:"200", _y:"100", ease:Strong.easeOut, onComplete:RunInnerAnimation} ); function RunInnerAnimation(){ TweenLite.to( mc_1.inner_animation, 1, {_x:"50", _y:"50", ease:Regular.easeOut} );} As you can see this method wont work, since i would have to write one function for each moveclip. I was thinking something like: This.inner_animation but couldnt make it work. Any smart guy out there? Link to comment Share on other sites More sharing options...
Share Posted June 26, 2013 Hi and welcome to the GreenSock forums. There are probably 3 or 4 ways to handle this based but here is one way with very little code and its very flexible: import com.greensock.*; //tween both mc's and offset their start times by 0.5 seconds //pass a reference to each tween via param "{self}" into the the onComplete callback TweenMax.staggerTo([mc1, mc2], 0.5, {_x:200, onComplete:innerAnimation, onCompleteParams:["{self}"]}, 0.5); //callback that starts animation on mc1.inner and mc2.inner //use tween param to find the target of each tween function innerAnimation(tween) { trace("done tweening " + tween.target._name); // this fires once for each mc being tweened TweenMax.to(tween.target.inner, 1, {_rotation:360, _xscale:10, _yscale:10, repeat:1, yoyo:true}); } I have attached a CS5 fla and swf triggerInnerAnimation_CS5.zip Link to comment Share on other sites More sharing options...
Author Share Posted June 27, 2013 Carl, thanks so much for taking the time to answer. That is exactly what i want to do. Unfortunately i had problems running the code in my own file. So I opened innerAnimation.fla to investigate what could it be. The first thing i noticed, was the animation was not working from Flash. Because i have GSAP v.11, i swap "staggerTo()" to "allTo()". Still didn't work. So i downloaded GSAP v.12 and got this message : The class or interface 'com.greensock.core.TweenCore' could not be loaded. What can i do? 1) I could stay on version 11, but -having changed staggerTo() to allTo()- the inner animation doesnt work. mc1 and m2 animate well, but inner animations dont. 2) when i changed to version 12 i got thar error... any hint? Link to comment Share on other sites More sharing options...
Share Posted June 27, 2013 Sounds like you are either missing GreenSock files or they are in the wrong place. I would strongly recommend sticking with v12. v11 doesn't support the feature I'm using here of sending a "{self"} reference of the tween into a callback parameter. I've attached a new zip that contains an fla and the greensock classes (version 12.0.11). You should have no problem opening the fla and compiling. Let us know if you still have trouble innerAnimation_CS5_GSAP_12_AS2.zip Link to comment Share on other sites More sharing options...
Author Share Posted June 27, 2013 It Worked!!! Carl,You are the boss. This made my day. Thanks so much. 1 Link to comment Share on other sites More sharing options...
Author Share Posted June 27, 2013 Is there a way i can edit this post title so i can put [sOLVED] ? Link to comment Share on other sites More sharing options...
Share Posted June 27, 2013 Don't worry about editing the post title. Its all good. Glad this info helped you. Happy Tweening! 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