keeping a line connection between two animating circles in animate CC (flash) - actionscript-3

I have two circles, with a line connecting their center points. I want to animate the position of the circles randomly, but keep the line attached to their centers no matter where they move. How do I do this (in code / as3?).

Related

Cocos Creator Collider do not collide?

I have 2 colliders: arrow and wheel (1 and 2).
wheel2 has a collider box which is a small square in the middle left (see image):
I rotate wheel2 and it collides with the arrow (https://i.imgur.com/kyYMzrE.mp4). Look good.
Now, I want the wheel to have many small colliders inside, so I replace wheel2 with wheel1 containing the children which are box colliders:
However, when I rotate wheel1, its child doesn't collide with the arrow: https://i.imgur.com/4ttU16U.mp4
What should I do?

AS3 spin text around center?

I am trying to get an effect like this:
http://www.welcomeanimations.com/welcome_animated_gifs_rotating_sign_orange_chrome_k_1.htm
I have tried all sorts of things:
Matrix translation/rotation - spins the text around the 'Z' axis, instead of 'Y'
Adding TextField to a sprite, and Sprite.rotationY++: reg. point is upper left corner
Adding to MovieClip - same as above (an article said MovieClip's reg. point was centered).
This should be trivial?!?! Help me stackoverflow, you're my only hope!
So you have to remember, Display objects scale and rotate around their local coordinate system. so when you put a textfield in a sprite, you need to center it in that sprite's coordinate system. And doing that for textfields is annoying because their width/height isn't always accurate but there is trick for that: get visual bounds, but normally you can take half of somethings width and height
I've created a prototype for you on wonderfl so you can see the solution working in action. Click on the blue square to see how the local coordinate system messes with the rotation
Finally as you use thing you might find things not rotating in 3D space quite right, this should be able to fix that.

Setting movieclip origin with AS3

I have a spotlight that moves on a stage.
Now I rotate the spotlight but its not rotating on the correct point/origin.
I am trying to do something like
myOject.setOrigin = {x , y};
//and then rotate it about x,y.
I have manually set the white circle in the correct place and when I rotate the
object with the mouse on the screen it works.
Can somebody help me?
Make sure the registration point is in the middle of your symbol. It's not the white circle that appears when you use the Free Transform Tool:
But the crosshair that appears when you edit your movie clip:
You can easily center the object by selecting everything, then opening the Align panel and aligning its horizontal and vertical axes to the center using the two "center" icons under the Align section. If your MC has multiple items per layer, group each layer before aligning, then ungroup after aligning:
The white circle is not what will be used as the origin, it's the little cross. Adjust your clip to have that in the center (you'll have to move all of it's contents). Another option, if moving is not possible, is to wrap your clip in another clip and move it within that.
Select symbol and click CTRL+E - Then move it to positioning cross.

Swing rotate border

I'm working on a swing program to display several pictures. And one can rotate the picture (implemented each as a JComponent).
Problem is, when a picture gets rotated, the border of the JComponent doesn't change so that the picture gets clipped.
Is there any way to also rotate the border so that the picture can be fully drawn?
(I know one can calculate the new size of the border, but it leaves empty space on the edge. When a rotated picture overlaps with another and one want to move the one underneath, one cannot do that because the event will be passed to the picture above, onto the transparent edge. So it is more ideal if one can just rotate the border).
Execute another pack() on your top-level JFrame after rotating.

Falling object in Box2D should rotate due to centre of mass?

I'm trying to simulate a falling balloon in Box2DAS3. What is important is that balloon falls the such that the bottom part were you blow it up rotates towards the bottom if it's knock sideways or is dropped at an angle.
alt text http://lh4.ggpht.com/_gjsCWAV_CZc/Sw7zqHahTJI/AAAAAAAAC3s/YIJka4AsM5s/s144/Untitled.jpg
I've tried offsetting the center of mass of the body and also joining two bodies together with the denser one representing the tie. In both cases the body falls at the same angle without rotating.
An object in free fall (vacuum), without any initial linear or angular velocity, will never start to spin by itself, no matter where its center of gravity lies. You need to simulate fluid drag and buoyancy. A simple way to this is to add a small force on the top of the balloon that points upwards.
Add a drag force to all objects. Something like -velocity / drag_amount