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

  • SEARCH
  • Home
  • 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 268815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:44:23+00:00 2026-05-11T23:44:23+00:00

I have a container MovieClip that serves as a content area that I need

  • 0

I have a container MovieClip that serves as a content area that I need to mask off. When I create a mask inside this container using a Shape I can’t seem to interact with the contents of other containers I create here, like buttons etc.

This is what I’m doing in code (I’ve left out all the import’s etc.):

class MyContainer extends MovieClip
{
   protected var masker : Shape = null;
   protected var panel : MyPanel = null;

   public function MyContainer()
   {
      this.masker = new Shape();
      this.masker.graphics.clear();
      this.masker.graphics.beginFill( 0x00ff00 );
      this.masker.graphics.drawRect(0, 0, 1, 1);  // 1x1 pixel.
      this.masker.graphics.endFill();
      addChild( this.masker );

      this.panel = new MyPanel();  // has buttons and stuff.
      addChild( this.panel );

      this.mask = this.masker;
   }

   // called by it's parent when the stage is resized.
   public function resize( width : Number, height : Number ) : void
   {
      // set the mask to half the size of the stage.
      this.masker.width  = width  / 2;
      this.masker.height = height / 2;

      // set the panel to half the size of the stage.
      this.panel.resize( width / 2, height / 2);
   }
}

When I add the mask (Shape) to the display hierarchy I can no longer interact with whatever buttons are defined in MyPanel. However, not adding the mask to the display hierarchy does let me interact with the contents on MyPanel but the mask is not sized/positioned correctly. I guess that when the mask is not added to the display hierarchy it sits in the top-left corner of the movie (I cannot prove this though).

How do I go about making my mask size/position correctly and let the user interact with the buttons in MyPanel?

  • 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-11T23:44:23+00:00Added an answer on May 11, 2026 at 11:44 pm
    this.masker.mouseEnabled = false; //set on this.masker
    

    That should work. Right now it is intercepting your events before they get to anything else in the container. Not 100% sure, but I believe a mask will sit on top of the container. Another option would be to add another masking child to MyContainer at the bottom of the displayList and add panel as its sibling. You will want to set mouseEnabled and mouseChildren to false on the masked sprite/mc still though.

    package
    {
        import flash.display.Shape;
        import flash.display.Sprite;
    
        public class MyContainer extends Sprite
        {
           protected var masker : Shape = null;
           protected var panel:MyPanel;
    
           public function MyContainer()
           {
    
              this.masker = new Shape();
              this.masker.graphics.clear();
              this.masker.graphics.beginFill( 0x00ff00 );
              this.masker.graphics.drawRect(0, 0, 1, 1);  // 1x1 pixel.
              this.masker.graphics.endFill();
              addChild( this.masker );
    
              this.panel = new MyPanel();
              this.addChild(panel);
              this.mask = this.masker;
           }
    
           // called by it's parent when the stage is resized.
           public function resize( width : Number, height : Number ) : void
           {
              // set the mask to half the size of the stage.
              this.masker.width  = width  / 2;
              this.masker.height = height / 2;
    
              // set the panel to half the size of the stage.
           }
        }
    }
    

    –

    package
    {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class MyPanel extends Sprite
        {
            public function MyPanel()
            {
                this.graphics.beginFill(0xFF0000)
                this.graphics.drawRect(0,0,10,10);
                this.addEventListener(MouseEvent.MOUSE_OVER, this.handleMouseOver)
                this.addEventListener(MouseEvent.MOUSE_OUT, this.handleMouseOut)
            }
    
            public function handleMouseOver(event:Event):void
            {
                this.graphics.clear();
                this.graphics.beginFill(0x00FF00)
                this.graphics.drawRect(0,0,10,10);
            }
    
            public function handleMouseOut(event:Event):void
            {
                this.graphics.clear();
                this.graphics.beginFill(0xFF0000)
                this.graphics.drawRect(0,0,10,10);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container that has several divs with content. i need to be
I have a movieclip wich has a simple movement of a simple shape. This
let's say I have two shapes wrapped in Movieclip container. How can I detect
I have a container div (red) with a top padding of 400px. The content
I have a container that is a popup over a page and it has
I have a container that is used to show a breadcrumb path through a
I have a container: divA. divB and divC are inside divA. Both divB and
I am having a similar issue to this post except that I am using
In my Flash project I have a movieclip that has 2 keyframes. Both frames
I have a library MovieClip Class that consists solely of a dynamic textfield contained

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.