[Papervision3D] Accessing the movie frames inInteractiveMovieAssetMaterial?

Noah Aronsson-Brown noah at rdai.com
Thu Sep 6 16:06:58 PDT 2007


Thanks for the suggestions, it certainly makes sense to instantiate separate
materials. However, having rewritten the code and done just that (i think)
it is finally gotoAndStopping correctly but it is still doing it to all of
the materials!

What am I doing wrong? Is an Array the wrong way to store the materials?

Here is the relevant code:

		protected var material			:Array = new Array();
		protected var plane				:Plane;

		protected function createScene():void
		{
			var num:Number = 6;
			
			for(i = 1; i <= num; i++ )
			{
				material[i] = new MovieAssetMaterial("boxMC", true, true);
				material[i].smooth = true;

				plane = new Plane( material[i], 100, 100 );
				plane.name = 'side'+i;
				scene.addChild( plane );
				
				var myTarget:MovieClip = material[i].movie as MovieClip;
				myTarget.gotoAndStop(i);

				plane.x = boxXNums[i-1];
				plane.y = boxYNums[i-1];
				plane.z = boxZNums[i-1];
		
				//item.lookAt(camera);
				
			}
				
			makeCube();
			
		};

Thanks again!

.noah


One problem you are probably having is that you are using the same material
for every plane.  Any change you make to the material will then be displayed
on every object using it.  The fix to create a new material for each object
(just put the material instatiation in the loop).

If you are having a problem still, call updateBitmap on the material after
you change the movie frame within it.  This will save you CPU over making
each material being animated (unless you want to animate it...).

Hth!

-andy

-- 
View this message in context: http://www.nabble.com/Accessing-the-movie-frames-in-InteractiveMovieAssetMaterial--tf4394173.html#a12533195
Sent from the Papervision3D mailing list archive at Nabble.com.




More information about the Papervision3D mailing list