PDA

View Full Version : adding bitmaps to sprites, not showing (pv3d)


jerryj
01-14-2008, 08:47 AM
Hi,

I am not sure if this is an actionscript or a Papervision issue that I have, so I thought I post it here too. I am adding bitmaps to sprites in a loop, but they only are being shown partly (not all of them) and randomly). If I add them one by one, outside the loop, they are shown correctly (but there 180 of them, so I don't want to do it that way).


private function createMaterial():void{

for( var m:uint=0; m< numOfPlanes; m++){


material[m] = new MovieAssetMaterial("MatAsset",true,true,true);
material[m].name="mat"+ m;
material[m].smooth = true;
material[m].oneSide = true;
material[m].opposite = true;
material[m].interactive = true;
Sprite(material[m].movie).cacheAsBitmap=true;
Sprite(material[m].movie).alpha=ALPHA_OUT;
//this only shows part of the bitmaps, randomly:
//Sprite(material[m].movie).addChild(Bitmap(picArray[m]));

//trace("Sprite(material["+ m+ "].movie).getChildAt(1) ="+ Sprite(material[m].movie).getChildAt(1));//traces 180 times [object Bitmap]
}
//this works:
Sprite(material[0].movie).addChild(Bitmap(picArray[0]));
Sprite(material[1].movie).addChild(Bitmap(picArray[1]));
Sprite(material[2].movie).addChild(Bitmap(picArray[2]));
Sprite(material[3].movie).addChild(Bitmap(picArray[3]));
Sprite(material[4].movie).addChild(Bitmap(picArray[4]));
Sprite(material[5].movie).addChild(Bitmap(picArray[5]));
}

I really don't know what is going wrong, so any help would be highly appreciated,

thanks,

Jerryj/