Symmetri Developer Blog

December 8, 2007

Interacting with Sandy 3D shapes

Flash/Flex/Actionscript - By Shourov Bhattacharya

Well, I finally got user interaction working with Sandy 3D objects. It took a bit of fiddling around, but it works. It’s fiddly because there is no obvious way to send the calling object to the event handler, so you end up responding to a mouse click without knowing where it came from. The trick in the event handler is to use event.target which will give you the container (but not the shape itself) where the container is of type Sprite. Then look through the Sandy static enumeration world.root.children to find the original Shape3D by comparing each shape’s container to the one you have.

Anyway, here is a quick example of interaction below. Click on the shape to get a random movement effect - animations are done with Tweener.



Comments »

No comments yet.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Janis Joseph