Does anyone know how to set up Planes with papervision, then retrieve them later?
I've set up the 3d scene like this:
PHP Code:
var con:Sprite = new Sprite();
con.x = this.width * 0.5;
con.y = this.height * 0.3;
holder.addChild(con);
var scene:MovieScene3D = new MovieScene3D(con);
var camera:Camera3D = new Camera3D();
camera.zoom = 0;
I've set up a plane for each object in an xml file:
PHP Code:
var mam:InteractiveMovieMaterial = new InteractiveMovieMaterial(item, true);
//mam.interactive = true;
mam.oneSide = false;
mam.smooth = true;
mam.animated = true;
var p:Plane = new Plane(mam, 131, 150, 7, 7);
p.x = Math.cos(i*anglePer) * radius;
p.z = Math.sin(i*anglePer) * radius;
p.rotationY = (-i*anglePer) * (180/Math.PI) + 270;
scene.addChild(p);
p.name = "p" + i;
trace (p.name);
then later I want to change each plane's color tint, depending on distance from the camera....
in my loop I've got:
PHP Code:
function loop(e:Event):void
{
camera.x = Math.cos(angleX) * 1000;
camera.z = Math.sin(angleX) * 1000;
scene.renderCamera(camera);
}
in that loop I want to put something like
PHP Code:
for(var i=0; i<scene.numChildren-1; i++)
{
var plane:DisplayObject = DisplayObject(con.getChildAt(i));
<change tint of each plane depending on distance from camera>
or retrieve the planes by name....
PHP Code:
for(var i=0; i<scene.numChildren-1; i++)
{
var p:Plane = Plane(scene.getChildByName(p[i]));
<change tint of each plane depending on distance from camera>
}
but none of these methods seem to work,, possibly because you can't do the same things to Planes that you can to movieclips...(?)
the scene.numChildren seems to work though.
Hoping someone can help!