Jump to content
Search Community

MouseOver/Out events seems to break MouseDown event

vyger test
Moderator Tag

Recommended Posts

Hi, in a Flash project I've some buttons in a menu and I dinamically set their behavior:

 

mc.addEventListener(MouseEvent.MOUSE_OVER,fadeIn);
mc.addEventListener(MouseEvent.MOUSE_OUT,fadeOut);
mc.addEventListener(MouseEvent.MOUSE_DOWN,manageMenu);

 

Every button contains an icon: onMouseOver the icon fades in, onMouseOut fades out, the manageMenu function features a fadeIn ONLY for the item clicked (a loop is used, etc.).

 

The fade code is fundamentally similar to this one:

 

var targetItem = e.currentTarget.getChildByName("icon_mc");

TweenLite.to(targetItem,0.2,{alpha:0.3});

 

But what happens. When I remove MOUSE_OVER and MOUSE_OUT events, the manageMenu method works almost perfectly. But when I add the MOUSE_OVER and MOUSE_OUT, when I click the menu icon, the icon doesn't fade in anymore and I can't understand why. I think it could be something related to the library TweenLite because if I comment the relative code in the body of the fadeIn/fadeOut methods the manageMenu method works again.

 

Any help is appreciated.

Link to comment
Share on other sites

It could be an Overwrite issues, it could be because you are using MOUSE_OVER and MOUSE_OUT instead of ROLL_OVER and ROLL_OUT.

 

there isn't much to go on from the little code you posted. the "loop, etc" that you refer to could be causing it. i don't know.

 

please attach a zip of your files that only contain these buttons and the code necessary to replicate the problem.

 

i'll be able to take a look it this afternoon or later tonight.

Link to comment
Share on other sites

Hi Carl, and thanks for your reply. The ROLL_OVER/OUT correction does not change the situation.

Furthermore, I can't post a zip because this code is contained in a huge project (and, most of all, I've no permission to send it before it is gone online).

 

Anyway, I can extract for you the manageMenu body:

 

public function manageMenu(e:MouseEvent):void

{

var targetItem = e.currentTarget.getChildByName("icon_mc");

// this SHOULD work but if MOUSE_OVER/OUT Events are set it doesn't. If you click 2 times it works again!...

// I tried killing the tweens of targetItem but I had no luck

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

//

var iC = menuContainer.getChildByName("itemsContainer") as MovieClip;

var menuContainerChildrenTotal = iC.numChildren;

// every menuItem that is not the one we click fades out

for (var i:uint = 0; i < menuContainerChildrenTotal; i++)

{

var children = iC.getChildAt(i);

var childrenName = children.name;

if (targetItem.parent.name != childrenName)

{

 

TweenLite.to(children.getChildByName("icon_mc"),0.3,{alpha:0.3});

}

}

//

TweenLite.to(dragger,0.5,{x:pt.x,alpha:1});

}

 

Thank you very much!

 

 

[EDIT] It happens with the native Tween too! If you directly set the alpha (eg. alpha=1) it doesn't happen. I think there's some conflict but killTweensOf doesn't solve the situation.

Link to comment
Share on other sites

I've looked over the code you have supplied and nothing jumps out at me for being the cause of the problem. sorry.

 

It would be a worthwhile endeavor for you to take the time to re-build this functionality in a separate fla file that only has a few buttons in it. They don't need to contain the production artwork.

You already have the code written. This exercise will help you isolate the issue and perhaps something will jump out at you in the process.

 

Furthermore, the people trying to help you will have a working example that they can add traces to and be able to to better visualize what is happening.

Link to comment
Share on other sites

Hi Carl, I've no time to extract a working sample: anyway THAT code is all the code involved in this issue.

I think this is an overwrite issue: I gave a look to the OverwriteManager but I have no time to understand and solve this issue. So, I asked my boss to change that behavior to direct alpha assignment (without tweening) and, dued to lack of time, he said it's ok. I'll back into this when it is possible. Thank you.

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