3 Replies Latest reply on Oct 23, 2007 7:42 AM by levancho

    Packages cannot be nested

    BarryGee Level 1
      Hi.

      I am having a little trouble with packages. when i run this code;

      import org.papervision3d.objects.Cube;

      //Do the imports
      import org.papervision3d.objects.DisplayObject3D;
      import org.papervision3d.cameras.Camera3D;
      import org.papervision3d.scenes.Scene3D;
      import org.papervision3d.objects.Plane;
      import org.papervision3d.materials.BitmapMaterial;
      import org.papervision3d.core.proto.MaterialObject3D;


      public var scene:Scene3D;
      public var camera:Camera3D;

      public var posX:Number;
      public var posY:Number;

      public function handleCreationComplete():void
      {

      camera = new Camera3D( new DisplayObject3D() );//make a camera
      camera.zoom = 20;//zoom it
      scene = new Scene3D( sceneTarget );//make my scene

      //Add my first cube
      var c:Cube = scene.addChild( new Cube(null,15,15,200,2,2,2) , "oneCube") as Cube;

      //set the container of the cube...
      //because I am using "Scene3D" the container isn't automatically created
      c.container = sceneTarget;

      addEventListener( Event.ENTER_FRAME , handleEnterFrame );


      }


      i get the following error;

      1114: The public attribute can only be used inside a package.
      for lines 13, 14, 16, 17 and 19.

      when i change this to add a package as follows;

      package {
      import org.papervision3d.objects.Cube;

      //Do the imports
      import org.papervision3d.objects.DisplayObject3D;
      import org.papervision3d.cameras.Camera3D;
      import org.papervision3d.scenes.Scene3D;
      import org.papervision3d.objects.Plane;
      import org.papervision3d.materials.BitmapMaterial;
      import org.papervision3d.core.proto.MaterialObject3D;


      public var scene:Scene3D;
      public var camera:Camera3D;

      public var posX:Number;
      public var posY:Number;

      public function handleCreationComplete():void
      {

      camera = new Camera3D( new DisplayObject3D() );//make a camera
      camera.zoom = 20;//zoom it
      scene = new Scene3D( sceneTarget );//make my scene

      //Add my first cube
      var c:Cube = scene.addChild( new Cube(null,15,15,200,2,2,2) , "oneCube") as Cube;

      //set the container of the cube...
      //because I am using "Scene3D" the container isn't automatically created
      c.container = sceneTarget;

      addEventListener( Event.ENTER_FRAME , handleEnterFrame );


      }
      }


      i get the following error;

      1037: Packages cannot be nested.

      can anyone help / make suggestions?

      Thanks

      Barry.