something like this:

var movieArray:Array = new Array();

movieArray = [
new MovieMaterial(yourMovieMaterial),
new MovieMaterial(yourMovieMaterial),
new MovieMaterial(yourMovieMaterial),
];

// plane generator

for (i=0;i<3;i++) {
var plane:Plane = new Plane();
plane.name = "myPlane"+String(i);
plane.material = movieArray[i];
}

that will assign separate materials to planes dynamically.

hope this helps

Morph
On 1 Oct 2009, at 17:33, Crisstyle wrote:


Could you provide an example? The planes are being generated on the
fly. Thanks.


On Oct 1, 2:26 am, Michael Iv <[email protected]> wrote:
Sure Man !. It is because it is the same Instance of the Material. You need to assign each plain different instance in order to control them separately

On Thu, Oct 1, 2009 at 2:45 AM, Crisstyle <[email protected]> wrote:

Im using the same 3 MovieMaterials on numerous planes in my scene. The
planes are put on the screen each time a click event happens by the
user and when I put them on screen I want to play an animation just
once. (Its basically a bomb that goes off and then shows a couple on
screen)

The problem I am having is due to using the same MovieMaterial on
numerous planes. The animation plays fine when the plane is put on the
screen, but then plays again if another plane is put on the screen
with the same MovieMaterial. I dont want this to happen more than once
for each plane.

Can someone help? Here is the function that gets called each time a
click event occurs:

public function createCouple():void
           {
                   var coupleName:MovieClip =
_coupleArray[_mathUtils.randRange(0, 2)]
as MovieClip;
                   var material:MovieMaterial = new
MovieMaterial(coupleName);
                   var materialMC:MovieClip = material.movie as
MovieClip;
                   var couplePlane:Plane = new Plane({material:
material, rotationX:
90, z: 100, x: 100, y: 100, width: 150, height: 275});

                   _viewPort3D.scene.addChild(couplePlane);
                   materialMC.gotoAndPlay(1);
           }

Reply via email to