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 8483385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:05:19+00:00 2026-06-10T20:05:19+00:00

Consider the following code. var sParent:Sprite = new Sprite(); var obj:Sprite = new Sprite();

  • 0

Consider the following code.

var sParent:Sprite = new Sprite();
var obj:Sprite = new Sprite();
var childA:Sprite = new Sprite();
var childB:Sprite = new Sprite();

sParent.addChild(obj);
obj.addChild(childA);
obj.addChild(childB);

childB.mouseChildren = false;
childB.mouseEnabled  = false;

sParent.addEventListener(MouseEvent.CLICK, itemClickHandler);
sParent.addEventListener(MouseEvent.ROLL_OVER, onHoverIn);
sParent.addEventListener(MouseEvent.ROLL_OUT, onHoverOut);

Now, I want to detect events on “ChildA” but I do not want to detect children on “ChildB”

mouseChildren = false; 

obviously isn’t the solution in this particular case. Any ideas?

  • 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-06-10T20:05:21+00:00Added an answer on June 10, 2026 at 8:05 pm

    Looks like it is a limitation or a design feature of ROLL_OVER, check the following program I have changed the ROLL_OVER event to MOUSE_OVER and target and currentTarget are giving the correct sprites :

    package 
    {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class Main extends Sprite 
        {
    
            public function Main():void 
            {
                if (stage) init();
                else addEventListener(Event.ADDED_TO_STAGE, init);
            }
    
            private function init(e:Event = null):void 
            {
                removeEventListener(Event.ADDED_TO_STAGE, init);
                // entry point
    
                var sParent:Sprite = new Sprite();
    
                var obj:Sprite = new Sprite();
    
                var childA:Sprite = new Sprite();
    
                childA.graphics.beginFill(0xff0000);
                childA.graphics.drawRect(0, 0, 100, 50);
                childA.graphics.endFill();
    
                var childB:Sprite = new Sprite();
                childB.x = 150;
                childB.graphics.beginFill(0x00ff00);
                childB.graphics.drawRect(0, 0, 100, 50);
                childB.graphics.endFill();
    
                sParent.addChild(obj);
                obj.addChild(childA);
                obj.addChild(childB);
    
                childB.mouseChildren = false;
                childB.mouseEnabled  = false;
    
                sParent.mouseEnabled = false;
                obj.mouseEnabled = false;
    
                sParent.addEventListener(MouseEvent.CLICK, itemClickHandler);
                sParent.addEventListener(MouseEvent.MOUSE_OVER, onHoverIn);
                sParent.addEventListener(MouseEvent.MOUSE_OUT, onHoverOut);
    
                addChild(sParent);
            }
    
            private function onHoverOut(e:MouseEvent):void 
            {
                trace(e.currentTarget.name+ " "+e.target.name);
            }
    
            private function onHoverIn(e:MouseEvent):void 
            {
                trace(e.currentTarget.name+ " "+e.target.name);
            }
    
            private function itemClickHandler(e:MouseEvent):void 
            {
                trace(e.currentTarget.name+ " "+e.target.name);
            }
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider The Following Actionscript/Flex code: var LC:LocalConnection=new LocalConnection(); LC.addEventListener(StatusEvent.STATUS, Status); LC.send('A', 'SomeMethodName', 'Message'); LC.send('B',
Consider the following code: var Widget = new Class({ Implements: [Options], options: { name
Consider the following code: using (var ms = new MemoryStream()) { using(var writer =
Consider the following code: ExecuteSQL(UPDATE ...); using (var t = new TransactionScope()) { ExecuteSQL(UPDATE
Consider the following code: var myDict = new Dictionary<string, int>(); myDict.Add(Key1, 1); myDict.Add(Key2, 2);
consider the following code: var t:Matrix3D = new Matrix3D( new Vector.<Number>([1,0,0,0,0,1,0,0,0,0,1,0,10,10,0,1]) ); trace(t.rawData[12]); the
Consider the following snippet of code: foreach (var setting in RequiredSettings) { try {
Consider the following code: var sentences = [ 'Lorem ipsum dolor sit amet, consectetur
Consider the following code: class Foo(var name: String = bar) Now i try to
Consider the following code: [Authenticate(Order = 1)] public ActionResult SomeActionThatRequiresAuthentication() { var model =

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.