Jump to content
Search Community

Tween conflicts on overlapping Movieclips

mulegoat test
Moderator Tag

Recommended Posts

Hello there!

 

I'm having problems when a ROLL_OVER / ROLL_OUT if the mouse is placed on the stage at a point where these two movieclips overlap. Flash fires both tweens repeatedly.

 

All I am trying to do is fire the movieclip instance title_mc once I ROLL_OVER the moveclip 'btn_mc'

 

Any suggestions?

 

stop();

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

OverwriteManager.init(2)

TweenPlugin.activate([AutoAlphaPlugin]);

btn_mc.buttonMode = true

TweenMax.to(btn_mc, 0.5, { autoAlpha:0.25, ease:Circ.easeOut } );

		btn_mc.addEventListener (MouseEvent.CLICK, buttonClickHandler);
		btn_mc.addEventListener(MouseEvent.ROLL_OVER, over1);
		btn_mc.addEventListener(MouseEvent.ROLL_OUT, out1);





function over1(event:MouseEvent):void {
		TweenMax.to(btn_mc, 0.5, {alpha:1, ease:Circ.easeOut});
		TweenMax.to(title_mc, 0.25, {y:111, alpha:1, ease:Circ.easeOut});



	}

function out1(event:MouseEvent):void {
		TweenMax.to(btn_mc, 0.25, {alpha:0.25, ease:Circ.easeOut});
		TweenMax.to(title_mc, 0.25, {y:165, alpha:0, ease:Circ.easeOut});

	}


Link to comment
Share on other sites

If title_mc is interfering with your event, you may want to try one or more of the following settings:

 

btn_mc.mouseChildren = false;
title_mc.mouseEnabled = false;

This will prevent both title_mc and any interior movieclips of btn-mc from firing events, which should hopefully leave just the actual ROLL_OVER and ROLL_OUT events for btn_mc.

 

 

When I create button transitions, I find it's easier to add the event listener to a parent movieclip of the buttons, or even the stage, and use functions similar to these:

 

function mouseover(e:MouseEvent):void {
   if ( e.target.name == "button1" ||
       e.target.name == "button2" ||
       e.target == btn_mc || )
   {
       TweenMax.to(e.target, 0.25, {alpha:1}); // rollover animation
   }
}
function mouseout(e:MouseEvent):void {
   if ( e.target.name == "button1" ||
       e.target.name == "button2" ||
       e.target == btn_mc )
   {
       TweenMax.to(e.target, 0.25, {alpha:0.5}); // rollout animation
   }
}

This way you can have a consistent transition effect on multiple buttons, and only 1 place to make any changes.

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