Oct 1 2009

How to Tween the Alpha Value of a Plane with MovieMaterial in Papervision 3D 2.0

I spent an inordinate amount of time figuring out how to tween the alpha value of a Plane with MovieMaterial in Papervision 3D today. In case it saves anyone out there some time, here's how to access it:

MovieMaterial(plane.material).movie.alpha

The DisplayObject3D class has an alpha property, but it doesn't seem to affect the material inside the object. I can't say I completely understand why it works, but it works. Note: The "animated" property of your MovieMaterial must be set to "true."

Oddly, this does not work:

plane.material.movie.alpha

Even though "plane.material" seems to be a MovieMaterial object, "movie" comes back as an undefined property when compiling. I'm sure it has something to do with data type information in AS3 that I don't quite comprehend yet.

In case this happens to be a weird version issue, I'm using OS X 10.5.8, Flash CS4 and Papervision3D 2.0.869. Lastly, here's the gotoAndLearn() forum thread that pointed me in the right direction.

2 comments

Hi,

MovieMaterial has the property "movie". It is the subclass of MaterialObject3D. The first argument of the Plane constructor has the type MaterialObject3D. Therefore, you needed to cast to MovieMaterial.

This is the doc: http://bit.ly/cErtR

Sincerely,

ozgur uksal — Nov 9 2009

I knew someone smarter would explain it eventually. Thanks, ozgur.

Robbie — Nov 9 2009