Skip to main content
December 8, 2012
Question

Floating/drifting objects

  • December 8, 2012
  • 1 reply
  • 703 views

Hello all,

I am trying to create a screen that involves circular images that are simply drifting around slowly in space, confined within a circular area. There would be simple collision detection to the extent that the images do not overlap eachother.  This could be a loopable video, or a coded environment that allows them to drift around forever. I am just looking for the most straightforward way of accomplishing this.

I may choose to incorporate physics, in that the images can be pushed with the mouse to bounce off of other images, but this is a secondary goal; I primarily just want to create the environment that allows the images to float around.

I am hopeful that there is a template somewhere on the Net that will allow me to swap in my own images or objects for the default objects in the template. I have seen this done before with Flash pulling from an XML file of objects with images associated with them. However, I do not know the code I would need to use to allow the images to float around randomly. I would rather not code the keyframe animations for this, since it seems quite tedious (unless there's an easier way to do it than a bunch of tweens).

Any help is appreciated. Thank you!

Taylor

This topic has been closed for replies.

1 reply

December 8, 2012

Hi again,

I found something that is exactly what I needed - http://www.emanueleferonato.com/2008/06/07/managing-multiple-balls-collisions-with-flash-as3-version/

However, I do not know how to add unique images to each ball. I have seen code where objects are created in reference to an XML list of properties, so each instance of the object has its own Image property that links to a unique image file, but I am unsure of how to add that functionality to this code.

Ned Murphy
Legend
December 8, 2012

What you can do is have the images as movieclip symbols in the library with linkages assigned to them, pretty much the same as what I am imagining is done for the Ball instances.  You can dynamically create instances of the image movieclips and add them as children of the Ball objects when you create the Ball instances in the BallCollision function.