[Papervision3D] Creating custom class that Extends Cube
Steve D
kruass at gmail.com
Tue Aug 5 10:47:19 PDT 2008
Instead of this = new Cube(), use super().
public function CubeNavItem() {
var material1:ColorMaterial = new
ColorMaterial(0x646500);
super(material1, 300, 15, 125, 2, 2, 2);
}
On Tue, Aug 5, 2008 at 10:27 AM, Stephen Barrante <
stephen.barrante at storyworldwide.com> wrote:
>
> Sorry to flood the boards with another basic AS3 question. But since it is
> definitely being complicated by the fact I'm using PV3D, hopefully someone
> can point me in the right direction.
>
> As the subject implies, I'm trying to create a custom class that Extends
> Cube. This way I can add Events to this particular Object and easily
> replicated it on the stage, e.g. Nav Items.
>
> Here is my code below:
>
>
> package {
> // Cube Nav Item
>
> import flash.events.*;
> import flash.filters.*;
>
> import org.papervision3d.objects.primitives.Cube;
> import org.papervision3d.materials.*
>
> import caurina.transitions.Tweener;
>
> public class CubeNavItem extends Cube {
>
> public function CubeNavItem() {
> var material1:ColorMaterial = new
> ColorMaterial(0x646500);
> this = new Cube(material1, 300, 15, 125, 2, 2, 2);
> }
> }
> }
>
>
> In my Main.as file I have code, simplified here:
>
> import CubeNavItem;
>
> var nav1:CubeNavItem;
>
> nav1= new CubeNavItem();
>
> scene.addChild(nav1);
>
>
> I get errors all over the place, but these are the most consistant:
>
> **Error** /Volumes/Creative/_Assets/Flash/Prototyping/Papervision
> 3D/Navigation/CubeNavItem.as, Line 14: 1203: No default constructor found
> in
> base class org.papervision3d.objects.primitives:Cube.
> public function CubeNavItem() {
>
> **Error** /Volumes/Creative/_Assets/Flash/Prototyping/Papervision
> 3D/Navigation/CubeNavItem.as, Line 33: 1050: Cannot assign to a
> non-reference value.
> this = new Cube(material1, 300, 15, 125, 2, 2, 2);
>
> **Error** /Volumes/Creative/_Assets/Flash/Prototyping/Papervision
> 3D/Navigation/CubeNavItem.as, Line 33: 1067: Implicit coercion of a value
> of
> type org.papervision3d.materials:ColorMaterial to an unrelated type
> org.papervision3d.materials.utils:MaterialsList.
> this = new Cube(material1, 300, 15, 125, 2, 2, 2);
>
> Depending on what "imports" I do in the CubeNavItem class, those error
> messages change. The first error is the most puzzling, of course since I'm
> EXTENDING Cube.
>
> I appreciate any suggestions anyone might have.
> --
> View this message in context:
> http://www.nabble.com/Creating-custom-class-that-Extends-Cube-tp18836032p18836032.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20080805/a0bd1a7b/attachment.html
More information about the Papervision3D
mailing list