PDA

View Full Version : Ellipse Container



Lindquist
May 28th, 2005, 11:03 PM
I threw this together in response to a question in the Actionscript forum.
There's a simpler version here:
http://www.kirupa.com/forum/showthread.php?t=98185

[uber]
May 29th, 2005, 03:09 AM
wow.. you got yourself a browser crasher...lol...


thats pretty neat... laggy but neat

booler
May 29th, 2005, 01:35 PM
choppy and gets squared (hard to explain) when you scroll

Lindquist
May 29th, 2005, 03:30 PM
I know it's pretty CPU intensive, I'm really hoping for better Actionscript performance in the next Flash player release.

SchnickelG
May 30th, 2005, 06:00 PM
How come when you view it in flash (ctrl-Enter), the bouncing thingies are out of the ellipse, but when you publish and view the swf, they are where they should be?

You enjoyed math in school?

Thanks much for the comments, that helps alot!

Thanks
Mathias

Lindquist
May 30th, 2005, 09:29 PM
The movement of the balls is only constrained to the width and height properties that you assign in the Actionscript. So you only think that the balls bounce of the walls when the graphic of the ellipse has nothing to do with the movement of the balls in any way. Flash is actually constantly calculating the distance of the ball from the center of the ellipse and comparing that number to the radius of the ellipse at the ball's given angle. I've never had the problem you mentioned, but the scaling of the ellipse graphic must being going out-of-whack for you.

I stopped enjoying math in school when it turned from logically figuring out and understanding all the formulas to memorizing countless formulas and just plugging in numbers. I also think my math teachers just plain sucked, which probably played a major role in me losing interest in math.

SchnickelG
May 30th, 2005, 10:06 PM
One last question (I Think).

When you draw the ellipse on the stage to show the borders, does the size of that correspond to some numbers in the actionscript?

It looks like it is just double the X and Y radius in the code?

Thanks
Mathias

Lindquist
May 30th, 2005, 10:08 PM
One last question (I Think).

When you draw the ellipse on the stage to show the borders, does the size of that correspond to some numbers in the actionscript?

It looks like it is just double the X and Y radius in the code?

Thanks
Mathias

You're exactly right :)

The ellipse on the stage should also have its registration point centered, then the X and Y coordinates of the ellipse should match the CENTX, CENTY in the Actionscript.