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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:41:03+00:00 2026-05-16T18:41:03+00:00

So i have this sprite that is say arbitrarily 100 x 100 which is

  • 0

So i have this sprite that is say arbitrarily 100 x 100 which is added to the stage. Now when content is added to this sprite the sprite expands automatically as it should. I dont want this to happen, what i want is to set a defined boundary i.e. 100 x 100, if too much content is added i can be able to scroll it. My problem is i cannot add a mask to the stage like the conventional way because i have many other boxes like this that vary in dimensions and number. I found a way i can do this but its very inefficient, what i did is i created a movieclip filled it say 100×100 with some color then instantiated it. Next i added the sprite and if content overlaps it wont be visible, only 100×100. I sort of stumbled on this and dont know exactly why this works. Any help is well appreciated, thank you.

Here is the code.

//a movieclip with its linkage called containerMasker has a blue square that serves as the mask

var myMasker = new containerMasker(); //the mask
var myContainer = new Sprite(); //the content being masked
//x and y coordinates fixed for both items, width also but no height

myMasker.addChild(myContainer);
addChild(myMasker);
  • 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-16T18:41:03+00:00Added an answer on May 16, 2026 at 6:41 pm

    here’s the standard way

    myContainer.mask = myMasker;
    addChild(myContainer);
    addChild(myMasker);
    

    now, if you need to do this with many boxes you could create a class to handle it

    public class MaskedItem extends MovieClip
    {
      public function MaskedItem(params:Object)
      {  
          var masker:Sprite = new Sprite();
          masker.graphics.beginFill(0);
          masker.graphics.drawRect( 0 , 0 , params.maskWidth , params.maskHeight );
          masker.graphics.endFill();
    
          var mc:MovieClip = params.displayObject as MovieClip;
          mc.mask = masker;
    
          addChild( masker );
          addChild( mc );
      }
    }
    

    then you could do

     var mc1:MovieClip = new MaskedItem({maskWidth:100, maskHeight:100 , displayObject:mc1} );
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's Say I Have This Class: package{ import flash.display.Sprite; public class Main extends Sprite{
Ok, I have no idea why this is happening. I'm made an Item class
I'm using XNA but it doesn't matter too much for this example. So let's
I have an NSMutableArray of Sprites and I want to remove a few of
I am writing a web application that has a page that returns a list
I have the following code in a project for the main navigation. It is
I am trying to make a calculator where a user can select from a
I'm coming to the end of my first year of CS and I thought
Kind of a dilemma here. I am making a mobile version of a website,

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.