[Papervision3D] loop position planes
Luis Eduardo
eduardo3r at gmail.com
Sat Sep 22 20:39:25 PDT 2007
If you want to use an array to hold your plane objects you can do it
this way :
var caso: Array= new Array();
for (var i2:Number =0; i2 < imageCount; i2++ ){
caso[i2]= new Plane( );
scene.addChild(caso[i2]);
}
should work fine.
-Luis
On 9/23/07, Cristian Diaz <elkraneo at gmail.com> wrote:
> thats my question how define the object, cause i defined 7 vars (in
> this case) one for each plane (ie, "caso1:Plane")
>
> On 9/22/07, Luis Eduardo <eduardo3r at gmail.com> wrote:
> > So how are you defining the object array "caso"? And what error are you getting?
> >
> > -Luis
> >
> > On 9/21/07, Cristian Diaz <elkraneo at gmail.com> wrote:
> > > yes i understand that, but the problem itself its the definiotn of the
> > > object "caso", returns me error....
> > >
> > > On 9/20/07, Dustin Sparks <djsparks at bsu.edu> wrote:
> > > > you need to use your variable "n" inside your loop somewhere. Right now its
> > > > setting every object on every loop to the same position.. try something like
> > > >
> > > > caso[n].x = math.cos(radian)*radius*n;
> > > >
> > > > or
> > > >
> > > > caso[n].y = -50 * n;
> > > >
> > > > or
> > > >
> > > > caso[n].rotationY = -step + 90 * n;
> > > >
> > > >
> > > > depending on what effect you want, each of those will mess with it
> > > > differently.
> > > >
> > > >
> > > > On 9/19/07, elkraneo <elkraneo at gmail.com> wrote:
> > > > >
> > > > > im trying to position a series of pre-created planes by using a loop, but
> > > > > cant make it work...can anybody give any advice about iterations in as3 ?
> > > > >
> > > > > private function crearPlanosCasos() {
> > > > > // Define the size of the circle of images we will
> > > > be making.
> > > > > // The higher the number, the larger the circle.
> > > > > perimeter = 6000;
> > > > > // From that, work out how large the circle is
> > > > > radius = perimeter/Math.PI/2;
> > > > >
> > > > > for (var n:Number=0; n<=imageCount; n++){
> > > > >
> > > > > var step:Number =
> > > > (180/imageCount)*(currentImage-1);
> > > > > var radian:Number =
> > > > deg2rad(step);
> > > > >
> > > > > caso[n].x =
> > > > Math.cos(radian)*radius;
> > > > > caso[n].z =
> > > > Math.sin(radian)*radius;
> > > > > caso[n].y = -50;
> > > > > caso[n].rotationY =
> > > > -step+90;
> > > > > // Include plane in our
> > > > 3D scene
> > > > > scene.addChild(caso[n],
> > > > "caso"+currentImage);
> > > > > currentImage++;
> > > > > }
> > > > > }
> > > > >
> > > > >
> > > > > private function deg2rad(degree):Number {
> > > > > // Convert degrees into radians
> > > > > return degree*(Math.PI/180);
> > > > > }
> > > > >
> > > > > perimeter, radius and planes defined previously , im having trouble with
> > > > the
> > > > > "caso[n].x" or any accessing property part...thx in advance
> > > > > --
> > > > > View this message in context:
> > > > http://www.nabble.com/loop-position-planes-tf4483754.html#a12786066
> > > > > Sent from the Papervision3D mailing list archive at Nabble.com.
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Papervision3D mailing list
> > > > > Papervision3D at osflash.org
> > > > >
> > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > [ Dustin Sparks ]
> > > > p. (765) 273-4793
> > > > _______________________________________________
> > > > Papervision3D mailing list
> > > > Papervision3D at osflash.org
> > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > >
> > > >
> > >
> > > _______________________________________________
> > > Papervision3D mailing list
> > > Papervision3D at osflash.org
> > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > >
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
More information about the Papervision3D
mailing list