title: Setting mask for sprite
body: <p>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 100x100 with some color then instantiated it. Next i added the sprite and if content overlaps it wont be visible, only 100x100. I sort of stumbled on this and dont know exactly why this works. Any help is well appreciated, thank you.</p>
  
  <p>Here is the code.</p>
  
  <pre><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);
  </code></pre>