Hand Cursor Issue - "Use Hand Cursor" Option Breaks Custom Function

Posted by jtwitkow 
Hand Cursor Issue - "Use Hand Cursor" Option Breaks Custom Function
October 24, 2009 07:30AM
For all those having issues with the "use hand cursor" not functioning as expected, I thought I would post this to help you out.

The issue:

I created a movie clip and set one of the button effects. Under options I selected "Use Hand Cursor". I also had the following custom function written for the button:

//----------------------------------------------------------

viewTeamBtn.addEventListener(MouseEvent.CLICK, myClick);

function myClick(e:MouseEvent):void
{
var moviestage_mc:MovieClip = MovieClip(parent.getChildByName("photoContainer_mc"));
moviestage_mc.gotoAndStop(2);

}

//--------------------------------------------------------------------------------

Everything worked fine UNTIL I checked the option for "Use Hand Cursor". Once that was checked, my function simply stopped responding. The hand cursor displayed, but nothing happened when I clicked the button. I added a trace statement, and nothing happened at all - the function simply wasn't running. Clicking on the button produced no results.

As soon as I unchecked the "Use Hand Cursor" option, everything began working again, of course without the hand cursor displaying. But I really wanted to display the hand cursor. Hmmmm???

The Solution:

What I ended up doing was adding two lines of code to my action script, and unchecked the "Use hand cursor" option. The two lines of code force the hand cursor to be displayed, but don't interfere with custom functions.

Here's the action script with the additional two lines added (remember to rename the instance name to match the instance name of your movie clip):

//-------------------------------------------

viewTeamBtn.addEventListener(MouseEvent.CLICK, myClick);
viewTeamBtn.buttonMode = true;
viewTeamBtn.mouseChildren = false;


function myClick(e:MouseEvent):void
{
var moviestage_mc:MovieClip = MovieClip(parent.getChildByName("photoContainer_mc"));
moviestage_mc.gotoAndStop(2);

}


//------------------------------------------------------------


Hopefully this helps others. And hopefully FlashEff will fix this bug.
Sorry, you do not have permission to post/reply in this forum.