As3 buttons – hand cursor not displaying
4:15 pm on December 17th, 2007, by Jeff Khan
When you add a listener to a movieclip and set it’s buttonMode to true:
buttonname.buttonMode = true;
it should then display the default hand cursor.
But when you have dynamic text inside the movieclip, (even if the text feild is not selectable!) your in for a world of hurt and debugging.
That is unless your set buttonname.mouseChildren = false; which makes the text inside the mc lose focus. It’s set to true by default
Category: Uncategorized 47 comments »
January 28th, 2008 at 12:20 pm
Love you. Thanks!
February 8th, 2008 at 9:28 pm
jeff your the best, saved me a lot of stress and work. How did you find out about this!
February 11th, 2008 at 12:48 pm
When you make sites it’s inevitable you’re going to make menu buttons with dynamic titles. It’s just bad luck that value is set to true by default. Just another nuance of AS3 i suppose.
And who reads though the help files anyway..!
February 29th, 2008 at 6:03 pm
Actually I thought it was the contrary so I set mouseChildren = true so as to force the textfield to display the button cursor. After a short while, quick reflex : google + bunch of good keywords and I ended up here. Thanks !
March 3rd, 2008 at 2:57 pm
you my friend are a genius and a godsend. lord knows how long it would have taken to work that out!
kudos. nice site by the way.
May 4th, 2008 at 12:16 pm
just use dynamicTXT.mouseEnabled = false;
no need for mouseChildren…
;)
May 13th, 2008 at 3:15 pm
Hey, yea. It probably is a really good hint. Unfortunatelly (unlike the others) I do have problems with it. If I do as you explained, my MouseEvent-Listener does not work anymore. Any Idea?
thx a lot
Paul
May 13th, 2008 at 3:40 pm
Again me. Found out what my Problem was about. Even if it seems strange … if I add a Listener to the Button Movie Clip, the target of the triggered Event is the textfield inside, and not the movieClip itself. Only if I set button.textfield.mouseEnabled to false or, as you did button.mouseChildren to false the button itself is the target. Does any of you get the sense in that?
August 3rd, 2008 at 9:50 pm
This is a first class post you have saved me a world of pain too!
August 20th, 2008 at 5:26 pm
Awesome. Thx.
August 29th, 2008 at 1:37 am
Huge Tip!
November 3rd, 2008 at 2:02 am
Thanks Awesome Tip
December 1st, 2008 at 12:24 pm
Paul – you are dead right. To turn a text field in a movie to show a link style hand cursor your have to put somethign like :
moviesname.textieldname.buttonMode = true;
Brilliant tips all round – cheers!
December 1st, 2008 at 12:51 pm
Sorry – last post update ( You need to also add in mouschildren = false — otherwise the mouse events dont fire properly. )
mc.buttonMode = true;
mc.mouseChildren = false;
For reference check out : http://www.xllusion.net/ed/2007/12/30/as3-buttonmode-issues/ .. implemented in in my code and works a treat
December 3rd, 2008 at 3:20 pm
I love a first google hit that solves your problem straight away. Thanks!
December 21st, 2008 at 1:26 pm
Great tip, I was trying to get this done for almost 30 minutes of googleing around, then finally and luckily found your page. I recently switched from AS2 to AS3 and there are quite some things to learn, but overall it is much more powerful and forces you to write clesn oo code.
Keep up the good work!
January 12th, 2009 at 6:40 pm
Guys,
If you want to have the hand cursor over a particular textbox inside a movie clip, you can try this..
textBox.mouseEnabled = false;
Thanks…
March 18th, 2009 at 2:34 am
I’m lucky, found you the moment i need you.
i never would’ve figured it out. AS3 is so stupid, my site is crashing like nobody’s business and I’m going to spend the night fixing it.
May 5th, 2009 at 8:21 pm
You saved me a lot of trouble – thank you very much!
November 24th, 2009 at 3:07 am
Thank you so much! This saved me so much work!!!
January 18th, 2010 at 10:54 pm
lova ya’
February 4th, 2010 at 6:14 pm
Thanks a million, I’m desiging a product to help millions of children, wonderful tip!
February 9th, 2010 at 4:04 am
Wow!!
I struggled so hard on this. I created so many work around and could not figure out why the Movie Clip would not register as the event target.
This is gold. Had to reverse engineer a bunch of stuff but so happy I got it working as I logically think it should.
February 12th, 2010 at 7:36 pm
Thanks so much! This saved a lot of hair pulling.
February 17th, 2010 at 3:43 pm
You saved me, after a year of not using flash, I almost forgot about this.
May 3rd, 2010 at 1:08 pm
GOAAAL!!!!
June 16th, 2010 at 10:03 pm
Thanx. Totally fresh to Actionscript 3.0 but this thread helped me out big time!
September 22nd, 2010 at 10:41 pm
Cheers! Just what I was looking for.
September 30th, 2010 at 12:00 am
Thanks for the tip!
October 5th, 2010 at 2:57 pm
THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!
October 31st, 2010 at 6:45 am
Thank you very much for saving my time.
December 1st, 2010 at 8:35 pm
Wow, came up first for me in Google when searching for “as3 cursor button.” Thank you!!
January 19th, 2011 at 7:16 am
Thank you very much!
January 26th, 2011 at 3:13 pm
thaaaaankkssssssssss!
the weir thing is thar I have done that before without the buttonname.mouseChildren = false; and had the same result! Dont know how!
February 17th, 2011 at 8:42 pm
Thanks man! Saved me!
March 29th, 2011 at 9:07 pm
Access of possibly undefined property mouseChildren through a reference with static type flash.display:SimpleButton.
I am getting this error, when i use the
mc.mouseChildren = false;
do i need to add anything else too?
April 6th, 2011 at 4:46 pm
Saved the Day, Thanks a lot!!!
April 16th, 2011 at 8:54 pm
Thanks that solved something I was just working on
April 19th, 2011 at 12:03 pm
thank u very much.
June 21st, 2011 at 9:27 am
Great save! Thanks.
July 4th, 2011 at 5:57 pm
Just has to change useHandCursor to buttonMode to display the hand, but thanks
August 31st, 2011 at 4:58 pm
Thank you very much!
September 30th, 2011 at 2:48 pm
I’ve got some text inside a button moviec, and the text field is bigger than the parent moviclip. Which means that the hit area for the mouseOver listener is bigger than the button … how do i set it so children text fields and MC’s don’t affect the hit area of the button?
October 16th, 2011 at 9:58 pm
thanks. this has bothered me for longggggggggggggggggg.
February 10th, 2012 at 12:23 pm
Cheers Jeff, saved me loads of searching
February 24th, 2012 at 10:56 am
Thanks for the tip. You saved my time
April 4th, 2012 at 3:15 am
Seriously…. you are a gentleman and a scholar. I been spending my days (after work, that is) trawling through tutorials and forums, trying to learn AS3 the <> way. Sure, I’ve found some seriously sweet tutorials in that time…. but this button issue of mine was driving me nuts, and your simple fix was so perfect for what I wanted to do that I just had to drop a ‘thank you’ comment. THANX!!!!!