Busy Busy with stacks of projects on hand. I am learning lotsa things while working on them. I love learning new stuffs and programming is my passion. So one project i am working on is flash web page. So i thought to make a 3D flash site with some cool effects. I chose papervision 3D for my project. I am happy with the outcome till now.

But anyway i am here to share some small problems that i face during the development and how i solved it. There must be newbies like me out there who might face this problem :D. So here i’l share how i faced a problem regarding playing movieclip animation mapped to 3d object on papervision 3d.
I had never used movieclip on my previous papervision projects, rather i used bitmaps for graphics. In my current 3d flash site project i was required to use some movieclips also. I opened the papervision documentation and found something called MovieMaterial for creating a texture from my movieclip instance in fla file. Using MovieMaterial is simillar to using ColorMaterial and BitmapFileMaterial. Here i will just be talking about MovieMaterial.
MovieMaterial creates a texture from movieclip to be mapped to 3d object like cube. So i created a MovieMaterial :

materialFront = new MovieMaterial(movieclip_instance1);
materialFront.smooth = true;

movieclip_instance1 is a instance of movieclip in fla library. So i am getting material/texture from the moviclip. So i created other materials for other faces of cube. Then i added all materials to the MaterialList:

cubeMaterials:MaterialsList = new MaterialsList();
cubeMaterials.addMaterial (materialFront, "front" );
cubeMaterials.addMaterial (materialBack, "back" );
cubeMaterials.addMaterial(materialTop , "top" );
cubeMaterials.addMaterial materialBottom, "bottom" );
cubeMaterials.addMaterial(materialLeft, "left" );
cubeMaterials.addMaterial(materialRight, "right" );

Now i just used this matriallist to the cube:

cuboid = new Cube(cubeMaterials, 750, 5, 500, 10, 10, 10);

So movieclip is mapped to all the faces of cube. So this is done. But those movieclips that i mapped were just a single graphics, it didn’t have frame animations inside movieclip. So i mapped a movieclip having animation into it to cube using same above steps and codes but viola, movieclip animation wasn’t playing, just first frame was getting rendered at the face of cube. So this was quite a problem for me because i wanted to render movieclip animation for giving nice effects.

I just googled on this topic and found the solution. I went to papervision documenation again and opened the MovieMaterial doc and looked at the constructor parameters. The last parameter in the MovieMaterial constructor specifies the additional properties associated with the movieclip. Default value is false. So i modified a line of code:

materialFront = new MovieMaterial(movieclip_instance1, true, true);

The second parameter specifies whether movieclip is transparent . Last parameter is what i needed to solve my problem, I passed it true saying i have animation into my movieclip and i want it to play when rendered. So viola movieclip animation was playing and i had a stupid grin on my face 😀