Skip to main content
Participant
December 23, 2010
Question

Simple Rotation Question?

  • December 23, 2010
  • 1 reply
  • 455 views

Hi,

I have a question on 3D rotation. Is it possible to rotate the entire scene in 3D? Or possibly move the default camera slightly in the X-axis programmatically? Thanks for your help in advance.

AR

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 23, 2010

it is but it's not a good idea.  you're better served to use a parent displayobjectcontainer, add all your displayobjects to it and rotate or translate that parent.

ajr321Author
Participant
December 23, 2010

Thanks for your prompt response, kglad. Basically, I have a few layers in different Z positions. I'm trying to get a 3D-look by rotating the scene a little. I'm doing this programmatically since I will be using the mouse positions to rotate. I'm new to actionscript so I'm not too sure how I can go about programming a displayobjectcontainer and then rotating it.

kglad
Community Expert
Community Expert
December 23, 2010

you can use the following to reparent everything on your main timeline (except the new parent) and then manipulate the new parent:

var sp:Sprite=new Sprite();

addChild(sp);

reparentF(MovieClip(root),sp);

function reparentF(originalParent:DisplayObjectContainer,newParent:DisplayObjectContainer):void{

for(var i:int=<originalParent.numChildren-1;i>=0;i--){

if(originalParent.getChildAt(i)!=newParent){

newParent.addChild(originalParent.getChildAt(i));

}

}

}