0
votes

I am using gestureworks with papervision 3d on Flex 4, and i am using AS 3. I experience one problem, which is that i keep getting error in the line - container.addChild(cone), and it give the output which is "1067 : Implicit coercion of a value of type import org.papervision3d.objects.primitives.Cone to an unrelated type flash.display:DisplayObject"

May i know what went wrong?

public class TouchApp extends Application

                : 
                :
                :

public function TouchApp():void

{

 cone = new Cone();

 scene = new Scene 3D;

 cam = new Camera 3D();

 viewport = new Viewport3D(800,600);

 addChild(viewport);

 container = new TouchSprite();

 rendEng = new BasicRenderEngine();

 addEventListener(Event,ENTER_FRAME, gestCone);

}

public function gestCone(E:Event):void

{

  container.blobContainerEnabled = true;

  container.addEventListener(TouchEvent.TOUCH_DOWN, downCone);

  container.addEventListener(TouchEvent.TOUCH_UP, upCone);

  **container.addChild(cone);**

  addChild(container);

  rendEng.renderScene(scene,cam,viewport);

}
1
So is this the only problem? You have syntax errors, there should be no space in "Camera 3D" and "Scene 3D". - Miha

1 Answers

1
votes

You are getting that error because TouchSprite expects a DisplayObject to be added to it's displaylist, whilst you are trying to add a pv3d object "Cone" which does not inherit from the DisplayObject class... You can try to use container.addChild(cone.container) but I'm not sure that will work...