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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:07:17+00:00 2026-05-22T18:07:17+00:00

I’ve got a container(sprite) with children(sprites) added to it. When I scale the container,

  • 0

I’ve got a container(sprite) with children(sprites) added to it.
When I scale the container, I would like to get the new width of a child, but when I trace the children’s width I always get the original dimensions, even though everything gets visually scaled as it should.
How do I overwrite the children-width ?

Update:
I just found out that the children.graphics-“dimensions” could have caused the problem. When I leave the graphics, everything seems ok. Is it possible to scale the graphics at same time as the child-sprite?

  • 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-22T18:07:18+00:00Added an answer on May 22, 2026 at 6:07 pm

    You can use DisplayObject.transform.pixelBounds.width or DisplayObject.transform.pixelBounds.height to get the width and height of the child display objects like in the following:

    package 
    {
        import flash.display.Sprite;
        import flash.events.Event;
    
        public class Main extends Sprite 
        {
            public function Main():void 
            {
                if (stage) init();
                else addEventListener(Event.ADDED_TO_STAGE, init);
    
            }// end function
    
            private function init(e:Event = null):void 
            {
                removeEventListener(Event.ADDED_TO_STAGE, init);
    
                var squaresXml:XML = 
    
                <squares>
                    <square name="redSquare" color="0xFF0000" />
                    <square name="blueSquare" color="0x00FF00" />
                    <square name="greenSquare" color="0x0000FF" />
                </squares>;
    
                var size:Number = 100;
    
                var squares:Sprite = new Sprite();
    
                for (var i:uint = 0; i < squaresXml.children().length(); i++)
                {
                    var square:Square = new Square(squaresXml.square[i].@color, size);
                    square.name = squaresXml.square[i].@name;
                    square.x = i * size;
                    squares.addChild(square);
    
                }// end for
    
                addChild(squares);
    
                squares.scaleX = squares.scaleY = 2;
    
                var redSquare:Square = squares.getChildByName("redSquare") as Square;
                trace(redSquare.width); // output: 100
                trace(redSquare.transform.pixelBounds.width); // output : 200;
    
            }// end function
    
        }// end class
    
    }// end package
    
    import flash.display.Shape;
    import flash.display.Sprite;
    
    internal class Square extends Shape
    {
        public function Square(color:uint, size:Number)
        {
            graphics.beginFill(color);
            graphics.drawRect(0, 0, size, size);
            graphics.endFill();
    
        }// end function
    
    }// end class
    

    DisplayObject.transform.pixelBounds basically gets “a Rectangle object that defines the bounding rectangle of the display object on the stage”.

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

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.