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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:48:29+00:00 2026-05-20T16:48:29+00:00

I’ve run into an odd problem in a pong/brick-breaker game I’m making: one of

  • 0

I’ve run into an odd problem in a pong/brick-breaker game I’m making: one of the player’s special abilities is to make a second ball split off from the main one and act exactly as the main one does for a short period before vanishing. The trouble is that when the second ball comes into contact with a stage boundary and is supposed to simply reverse its x or y velocity (depending on the boundary hit), it also apparently increases its width and height properties for some odd reason. The graphic doesn’t change, but the values of width and height do (drastically) and this results in some stuckHandler methods I’ve defined for the odd situation where a ball ends up partially offstage getting called repeatedly. Nowhere in the code do I change width, height, or scaleX/scaleY properties, so I have no idea why this is happening. In reading the adobe documentation I found the following two points to be of potential interest regarding this matter–

  1. Keyword THIS: A reference to a method’s containing object. When a script executes, the ‘this’ keyword references the object that contains the script. Inside a method body, the ‘this’ keyword references the class instance that contains the called method.
    —Isn’t this two ways to say the same thing? I don’t quite understand the particulars of the scope difference between ‘this’ at the start of a script and ‘this’ inside a method… Since the second ball object is created dynamically during play (the primary ball is a static object created pre-runtime and is controlled via a distinct driver class Ball) and is actually linked to a class Ball2 which controls and constructs it, the ‘this’ keyword is used a lot in different places throughout the class to reference thew graphic. I fear some confusion over the nuances surrounding ‘this’ in AS3 may be partly to blame for the odd circumstances I’m seeing.

  2. Width/Height properties: Indicates the width/height of the display object, in pixels. The width/height is calculated based on the bounds of the content of the display object. When you set the width/height property, the scaleX/scaleY property is adjusted accordingly.
    —What exactly do they mean by ‘content of the display object’? Is that just the graphic or could it be something else under certain circumstances? Could the content change after a velocity reversal for some reason? Via debugging print statements, I found that at the point where the width and height expand the scaleX and scaleY properties remain at 1, indicating that Flash doesn’t ‘know’ the object’s size effectively changed…

I’ve attached the output log which shows a number of properties pertinent to the second ball’s position, velocity, and size, and how they change over time. You can see that the width and height properties increase dramatically just after a velocity reversal, which indicates collision with a boundary. Also of note is that the second ball is created as a child of the main document class (which has no transformations applied to it, and is actually never added to the display list) and it seems to operate off of the proper stage-global coordinate system.

ffLog.txt
Ball2.txt

  • 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-20T16:48:30+00:00Added an answer on May 20, 2026 at 4:48 pm

    From your Ball2 class:

    ...
    callParts = new CallParts((this.x + (this.width/2)),50);
    addChild(callParts);
    

    You’re adding child of some size to ball. No wonder that its size is increased. DisplayObject is always big enough to contain its children and/or graphic shapes. Are you sure your objects are nested properly?

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ 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.