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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:35:33+00:00 2026-05-24T05:35:33+00:00

The problem is if I set the .mask property of a Sprite object, the

  • 0

The problem is if I set the .mask property of a Sprite object, the Sprite object still returns it’s full height when I call Sprite.height. So I figured a simple way to overcome this would be to override the property getter.

Now.. even though that worked, if I add this masked Sprite object to another Sprite object, the new Sprite object will report it’s height as the masked Sprite object’s height even though I have overridden the property to return only the height of the visible area due to the mask. So it seems Flash ignores the fact that not all of the content is visible but still automatically increases the new Sprite object’s height as if there was no mask on the masked Sprite.

So I am wondering if there is a workaround so I can add this masked object to any other DisplayObject knowing it will be resized to only what is visible in the masked object.

Thanks for any help.

EDIT

Here is a code example..

var content:Bitmap = new Bitmap(new BitmapData(50, 100, false, 0x000000));
var container:Sprite = new Sprite();
var mask:Bitmap = new Bitmap(new BitmapData(50, 50, false, 0x000000));

container.mask = mask;

container.addChild(content);

trace(container.height) // this should return 50 instead of 100
  • 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-24T05:35:34+00:00Added an answer on May 24, 2026 at 5:35 am

    So for those interested I managed to come up with a workaround. What really annoys me is that DisplayObject.scrollRect doesn’t update the dimensions immediately so until Adobe get off their arse and fix it, here’s what you need to do.

    The problem with .scrollRect, as I’ve mentioned, is that it doesn’t adjust to the new width and height until after a frame has passed or after a certain amount of time. Either way I’ve basically built my class so that once .scrollRect is set, I create a timer that runs every millisecond, checking if .width and .height has updated to the new values. Once it has, I dispatch a custom READY event which the parent object listens out for before adding the class to the stage.

    Now one very important thing you need to know about this arsehole of a property is that the object of which you are setting the .scrollRect property must be added to the stage before it makes any attempt at updating it’s width and height values to those set in the .scrollRect property. So to do this as clean as possible, I pass the Stage object from my main class to the object whose .scrollRect I want to adjust, let’s call it MyClass. MyClass sets its .visible property to false then adds itself to the stage. Only once this is done can I now begin my 1ms timer to check if the dimensions have changed correctly after I have set .scrollRect.

    So once the timer tick handling function sees the dimensions have changed successfully, MyClass can now dispatch the MyClass.READY event to the main class while at the same time, setting its .visible property to true and removing itself from the stage. When the main class’s event listener is triggered, it can now add MyClass to wherever it wants to, knowing that it will have the correct dimensions as set in MyClass.scrollRect.

    This has been a great pain to myself and probably many other developers looking for solutions so I hope this has helped you and will suffice for now until Adobe does something about this. Thanks to everyone who posted previously who tried to help, I really appreciate it, thanks!

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

Sidebar

Related Questions

Load mask not working, I set property loadMask: true and I still have the
i get a problem to set the callback function before indexeddb add transaction os
I had a problem with set not working in a batch file; it took
I am having problem to set label at right corner in ToolBar . Hear
The problem: I have set of pictures, when the user presses on one of
Memory leak problem - NSConcreteData // to set tip - photo in photo frame
I am doing a transformation from a customoized set cover problem to a sat,
First the practical application that led me to the problem: Given a set of
I have no good title for this question, but my problem is to set
Problem: I have a value that is set in $record, for instance 1.69. Then

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.