Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 275065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:42:25+00:00 2026-05-12T00:42:25+00:00

I make a sprite, then add a child sprite. I add a listener to

  • 0

I make a sprite, then add a child sprite.

I add a listener to the child for MOUSE_OUT events.

If my mouse is in the child sprite when I set the parent sprite mouseEnabled=false and mouseChildren=false, MOUSE_OUT is not fired on the child.

But then, when I move the mouse, MOUSE_OUT is fired on the child. MOUSE_OUT is also fired if I click. MOUSE_OUT is not fired if I mousewheel.

So, what’s going on here?

This is a related question.


After studying back2dos’ code, I discovered what I am doing differently is calling stage.focus = null just before setting mouseChildren = mouseEnabled = false. I am setting the stage focus to null to clear the blinking cursor from a textfield… is there a better way to do this?


here is back2dos’ modified code. steps to reproduce: click the textfield, get the blinking cursor. click the “button”, but don’t move the mouse between down and up. note the cursor is not blinking (good). also note that the mouse_out events on the button have not fired. until you move or click the mouse.

package  {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.ColorTransform;
    public class Test extends Sprite {
        private var child:Sprite
        public function Test() {
                this.addChild(child = new Sprite());
                child.graphics.beginFill(0xFF0000);
                child.graphics.drawRect(0, 0, 100, 20);
                child.addEventListener(MouseEvent.CLICK, onClick);
                child.addEventListener(MouseEvent.MOUSE_OUT, onOut);
                child.addEventListener(MouseEvent.MOUSE_OVER, onOver);


        tf = new TextField( );
        tf.backgroundColor = 0xFF00AA;
        tf.background = true;
        tf.type = TextFieldType.INPUT;
        tf.text = "yo";
        tf.y = 100;
        this.addChild( tf );
        }
        private function onOver(e:MouseEvent):void {
                child.transform.colorTransform = new ColorTransform(0, 0, 0, 1, 0, 0xFF);
        }
        private function onOut(e:MouseEvent):void {
                child.transform.colorTransform = new ColorTransform();
        }
        private function onClick(e:MouseEvent):void {
            //try it here...
            stage.focus = null;
                this.mouseChildren = this.mouseEnabled = false;
                //or try it here...
                //stage.focus = null;
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:42:26+00:00Added an answer on May 12, 2026 at 12:42 am

    there must be something wrong with your code … i have a minimum setup here:

    package  {
        import flash.display.*;
        import flash.events.*;
        import flash.geom.ColorTransform;
        public class Test extends Sprite {
            private var child:Sprite
            public function Test() {
                this.addChild(child = new Sprite());
                child.graphics.beginFill(0xFF0000);
                child.graphics.drawRect(0, 0, 100, 20);
                child.addEventListener(MouseEvent.CLICK, onClick);
                child.addEventListener(MouseEvent.MOUSE_OUT, onOut);
                child.addEventListener(MouseEvent.MOUSE_OVER, onOver);
            }
            private function onOver(e:MouseEvent):void {
                child.transform.colorTransform = new ColorTransform(0, 0, 0, 1, 0, 0xFF);
            }
            private function onOut(e:MouseEvent):void {
                child.transform.colorTransform = new ColorTransform();
            }
            private function onClick(e:MouseEvent):void {
                this.mouseChildren = this.mouseEnabled = false;
            }
        }
    }
    

    should turn green, when you mouse over, and red again, if you mouse out … on click, it is disabled with this.mouseChildren = this.mouseEnabled = false … on my machine, this triggers mouseOut (so the rectangle turns red again) … this makes sense to me … and the thing with getting mouse outs when clicking, is a definite indicator to me, you must be having a bug somewhere … could you try to reduce the problem and post it?

    greetz

    back2dos

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I add my sprite frames to CCSpriteFrameCache . Then I create a CCSpriteBatchNode with
I am trying to make a sprite follow a bezier curve. I found a
Hey all I'm trying to make a 3d game in with 2d sprite characters.
I'm using AndEngine to make a game. The user creates a sprite when they
I'm looking to make an image sprite fade in after a certain amount of
I'm trying to learn how to make an animated sprite in android and couldn't
I want to create an action once, then add it to multiple sprites. For
I am trying to make a multi-textured point sprite for an iphone application using
I'm trying to make it so when a sprite which is attached to a
make /bin/sh /Users/myusername/Downloads/php-5.3.5/ext/mssql/libtool --mode=compile cc -I. -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -DPHP_ATOM_INC -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/include -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/main -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.