Jump to content


menu tweening..tweening the whole _mc

Recommended Posts


I'm missing something from my code but for the life of me can't seem to figure it out. I created a class to handle my button actions, MouseOver,Off and will also handle the click function.

I got it working but I'm lost as to how I target just the button that I am rolling on to and not the movieClip the button lives in. Here is my code:


package classes.menu
import flash.display.*;
import flash.text.TextField;
import flash.events.*;
import com.greensock.*;
import com.greensock.easing.*;

public class MenuButtons extends MovieClip
	public function MenuButtons()
		this.mouseChildren = false;
		this.buttonMode = true;
	public function addButtonTitles():void
		trace("menu buttons");
		this.addEventListener(MouseEvent.MOUSE_OVER, rollOverBtn);
		homeBtn.white.txt.text = "HOME";
		homeBtn.blue.txt.text = "HOME";
	public function rollOverBtn(event:MouseEvent):void
			this.addEventListener(MouseEvent.MOUSE_OUT, rollOffBtn);
			public function rollOffBtn(event:MouseEvent):void


As I said before when I roll over one of the buttons I just want that button to alpha fade, not the whole _mc that it lives int. I tried to use event.target but that didn't seem to do what I was looking for.

Any help on this would be very grateful!



Link to comment
Share on other sites

Hey iceKomo,


I'm flying a bit blind here but what I'll take a stab.


what happens if you remove


this.mouseChildren = false.


does this class define the behavior of a menu that contains individual buttons or does it define the behavior of an individual button?


the best thing to do is run a trace(event.target.name) in your mouse event handler functions. I'm thinking that killing the mouseChildren is preventing subclips from being the target of mouse events.



Link to comment
Share on other sites

Also, be careful about using MOUSE_OVER/MOUSE_OUT instead of ROLL_OVER/ROLL_OUT. It's a common mistake. See http://www.greensock.com/tweening-tips/#mouseover


Why are you adding a MOUSE_OUT listener each time a MOUSE_OVER happens? Just curious. The typical way of dealing with this is to add ROLL_OVER and ROLL_OUT listeners once initially and that's it.


Is there a reason you're not using "this" as the target of your tweens? That might work better than event.target in this scenario. Like:

TweenLite.to(this, 1, {alpha:1});


It might also be beneficial to read up on the difference between event.target and event.currentTarget.

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.