Discussion:
Main PV3D light accessible to child objects?
Kevin Burke
2010-10-07 15:56:43 UTC
Permalink
Hi,
I'm creating a Papervision3D scene in a document class. I have added an
instance of a PointLight3D object. I'd like to create a class that uses the
light instance in the main document class for its material. What would the
Actionscript be to do this? I can't refer to the light as super.light
because my class is inheriting the Sphere class. parent.light does not work
either (even if I wait for the class to be added to the stage). Thank you!

-Kevin
--
View this message in context: http://papervision3d.758870.n4.nabble.com/Main-PV3D-light-accessible-to-child-objects-tp2967075p2967075.html
Sent from the Papervision3D mailing list archive at Nabble.com.
Kevin Burke
2010-10-13 19:57:59 UTC
Permalink
To access a light in the document class, one has to set the light to a static
public variable like so:
static public var light:PointLight3D;

Then, from the subclass of an object within your scene, you can call it like
in this format: DocumentClass.light

For example, if your class extended the Sphere class and you wanted to use a
shaded material that used a light in the document class (in this example,
named Main.as), you'd reference it like this:
mat = new GouraudMaterial(Main.light, 0xFFFFFF, 0x000000);
super(mat, 40, 8, 8);
--
View this message in context: http://papervision3d.758870.n4.nabble.com/Main-PV3D-light-accessible-to-child-objects-tp2967075p2994352.html
Sent from the Papervision3D mailing list archive at Nabble.com.
Loading...