This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=356 as retrieved on 1 Aug 2007 08:32:05 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:I1YOUCsnZrIJ:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D356+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=33


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ selecting and moving individual objects

Posted by: wil Mar 6 2007, 03:27 AM

Hi all,

I'm new to all this and just trying to get my head around targeting and transforming individual objects.
I want to create say, 5 cubes. Then I want to be able to select any one of them and move them individually of each other.
Any guidance would be greatly appreciated.

Thanks!!

Posted by: zeusprod Mar 6 2007, 02:56 PM

QUOTE(wil @ Mar 5 2007, 10:27 PM) *

Hi all,

I'm new to all this and just trying to get my head around targeting and transforming individual objects.
I want to create say, 5 cubes. Then I want to be able to select any one of them and move them individually of each other.
Any guidance would be greatly appreciated.

Thanks!!



When you add an object to the world, wrap it in a Transform3D as shown in Petit's Tutorials (http://www.petitpub.com/labs/media/flash/sandy/transformations.shtml).

Here is some code showing translation (I removed the rotation for clarity). It assume "cube" is an Box object and bg is the root group

// First we create the TransformationGroups
var tTrans:TransformGroup = new TransformGroup();
// We create Transform3D to carry out the transformation in 3 dimensions
var translation = new Transform3D();
// The translation is set in the transform group which will hold our cube
tTrans.setTransform( translation );
// The rotation is added to the translation
tTrans.addChild(cube );
// And finally the transformgroup is added as a child to the rootGroup
bg.addChild( tTrans );

Then, you can move the object by setting a new translation vector.

Since each object has its own translation group, they can be targeted independently.

When I create my objects, I do so with a class that wraps them in separate groups for scaling, rotation, and translation. Then I can control those independently for each object.

I hope that helps.

Cheers,
Bruce

Posted by: wil Mar 20 2007, 10:46 PM

Thanks so much for your reply Bruce. Ill give it a go.

regards,

wil

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)