As3 buttons – hand cursor not displaying

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

Leave a Reply

Spam protection by WP Captcha-Free

  1. Jeff

    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..! :)

  2. Antyler

    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 !

  3. koose

    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.

  4. msfx

    just use dynamicTXT.mouseEnabled = false;

    no need for mouseChildren… :) ;)

  5. Paul

    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

  6. Paul

    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?

  7. Sam Allen

    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!

  8. Paul

    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!

  9. Anees

    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…

  10. Hunson

    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.

  11. Shane

    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.

  12. Felicia

    Thanx. Totally fresh to Actionscript 3.0 but this thread helped me out big time!

  13. proxykitten

    Wow, came up first for me in Google when searching for “as3 cursor button.” Thank you!!

  14. Raphael

    thaaaaankkssssssssss!
    the weir thing is thar I have done that before without the buttonname.mouseChildren = false; and had the same result! Dont know how!

  15. hanna

    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?

  16. Matt

    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?

  17. Aaron

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

  18. Panda

    I love how many people are declaring their love for you here.
    Genius and super simple fix. Thanks so much for posting, you saved me hours of messing.

Posted