Jump to content
Search Community

a killTweensOf question

chuckndestroy test
Moderator Tag

Recommended Posts

New to the forum, and I tried to find if someone else had my problem but doesn't seem so.

 

I am building a pretty simple site for myself. Something similar to THIS.

 

Where I am getting hung up is trying to implement the killTweensOf via TweenMax or TimelineLite/Max. I saw a post about doing it through an array, but that didn't do it either. On that example site, when you move from one button to another, the other disappears. On my .fla I have it set-up a little different, but same concept. If someone that understands TweenLite/Max could help shed some light for me, that would be marvellous!

 

To keep ya from being blind, here's the part of my code I'm perplexed with.

test_btn.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
function overHandler(event:MouseEvent):void {
TweenMax.to(booger2_mc, .5, {bezier:[{x:263.2, y:89.5}], ease:Expo.easeOut});
TweenMax.to(dropdown_mc, 1, {bezier:[{x:0, y:134.2}], ease:Bounce.easeOut});

}

test1_btn.addEventListener(MouseEvent.MOUSE_OVER, overHandler1);
function overHandler1(event:MouseEvent):void {
TweenMax.to(booger1_mc, .5, {bezier:[{x:361, y:89.5}], ease:Expo.easeOut});
TweenMax.to(dropdown_mc, 1, {bezier:[{x:0, y:134.2}], ease:Bounce.easeOut});

}

test2_btn.addEventListener(MouseEvent.MOUSE_OVER, overHandler2);
function overHandler2(event:MouseEvent):void {
TweenMax.to(booger3_mc, .5, {bezier:[{x:462.2, y:89.5}], ease:Expo.easeOut});
TweenMax.to(dropdown_mc, 1, {bezier:[{x:0, y:134.2}], ease:Bounce.easeOut});

}

dropdown_mc.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
function outHandler(event:MouseEvent):void {
TweenMax.to(booger3_mc, .6, {bezier:[{x:462.2, y:50.5}], ease:Expo.easeIn});
TweenMax.to(booger2_mc, .6, {bezier:[{x:263.2, y:50.5}], ease:Expo.easeIn});
TweenMax.to(booger1_mc, .6, {bezier:[{x:361, y:50.5}], ease:Expo.easeIn});
TweenMax.to(dropdown_mc, .93, {bezier:[{x:0, y:91.2}], ease:Expo.easeIn});
}

Each _btn has a small bit of code internally making it a MC button. Just so it'll change color when moused over and that's partly why I'm trying to kill it when mousing over one of the other buttons.

 

Thank you in advance,

Charlie

Link to comment
Share on other sites

I'm having a hard time understanding exactly what the problem/question is. Are you saying TweenMax.killTweensOf(yourObject) isn't working? Have you read up on the various overwriting modes at http://blog.greensock.com/overwritemanager/? I looked at the example site and were you saying you wanted the same effect as the submenus that fade in under each main menu? It'd sure be swell if you could whip together a sample FLA that demonstrates the issue in as simple a manner possible. (sorry, I'm rather sleep-deprived at the moment and may be missing some obvious stuff)

Link to comment
Share on other sites

So I would like to say thank you for creating TweenLite/Max. I'm awe-inspired right now at how quick I pretty much re-did my test to make a sample for you to look at. It was only thirty minutes, and there it was. I compressed the file because the forum wouldn't let me attach just the .fla file.

 

About how I am trying to make the buttons and everything display, when you first roll over the "test" button, the submenu drops with the buttons that exist for that section. If I were to move the mouse over to "test1" I want the "test" MC to finish instead of waiting for me to mouse out of the submenu bar. Same for "test2". What happens right now is I'll mouse over "test" and then "test1" and the mc for "test" just stays. It doesn't retreat back up even though I have implemented the killTweensOf and OverwriteManager.init(2)/(5). I tried both AUTO and PREEXISTING. Couldn't get it to work in the manner I wanted it too. Also, and this may be because I haven't looked into it yet, but when I mouse over the submenu button, the MC will begin to retreat back up because I no longer have the mouse on the submenu. That may just be a TimelineLite gotoAndStop() instance. I'm gonna look into it tomorrow when I wake up.

 

And I hear ya about being sleep deprived! My sleep schedule right now is hit the hay at dawn, and wake up at 2 in the afternoon.

 

I appreciate your time.

Link to comment
Share on other sites

Oh! I see the misunderstanding - it sounds like you expected killTweensOf() to actually get all the tweens of the object and play them in reverse! When you kill a tween, it immediately stops it and makes it eligible for garbage collection. You're welcome to reverse() a tween if you prefer, though. And you were trying to pass multiple objects to the killTweensOf() - don't do that. It kills tweens for one object, so if you want to kill tweens of 2 objects, you'd call killTweensOf(object1) and then killTweensOf(object2).

 

I was a bit confused as to why you were doing a bezier tween with only one point in it - that's the same as just doing a normal linear tween, but it is more processor-intensive. For example, the following lines are functionally equivalent:

 

TweenMax.to(blah_mc, .93, {bezier:[{x:283.5, y:123}], ease:Expo.easeIn})
TweenMax.to(blah_mc, .93, {x:283.5, y:123, ease:Expo.easeIn})

 

What you're trying to do with your navigation is definitely possible but I don't have time to write the code for you or walk you through it (I'm working against some deadlines). Hopefully this info is helpful, though.

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...