Hi,

I saw Away3D demos they are pretty impressive then Papervision3D. I am
trying to learn Away3D using their built 3.5.0 as it’s latest and
stable (crossing my fingers). I tried first program and voilaa I found
really strange error I will show you my code here (This is one example
I downloaded from tutorials)

//**********************************************//
package
{
import away3d.cameras.HoverCamera3D;
import away3d.cameras.TargetCamera3D;
import away3d.containers.View3D;
import away3d.core.base.Object3D;
import away3d.events.MouseEvent3D;
import away3d.primitives.Cone;
import away3d.primitives.Cube;
import away3d.primitives.Sphere;

import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;

[SWF(width="500", height="400", frameRate="60",
backgroundColor="#FFFFFF")]
public class _3dcam extends Sprite
{
private var cam:HoverCamera3D;
private var lastKey:uint;
private var keyIsDown:Boolean = false;
private var View:View3D;
private var cover:Cover;

private var sphere:Sphere;
private var cone:Cone;
private var cube:Cube;

public function _3dcam()
{
// create a basic camera
cam = new HoverCamera3D();
cam.z = -1000; // make sure it’s positioned away from the default
0,0,0 coordinate
cam.panangle = 0;
cam.tiltangle = 0;
cam.targetpanangle = 0;
cam.targettiltangle = 0;
cam.mintiltangle = -90;

// create a viewport
View = new View3D({camera:cam,x:250,y:200});
addChild(View);

// make some objects and put it on the 3D stage
sphere = new Sphere({material:”red#black”,radius:50});
View.scene.addChild(sphere);
cone = new Cone({material:”green#black”, radius:50, height:100,
x:-150});
View.scene.addChild(cone);
cube = new Cube({material:”blue#black”, depth:100, width:100, height:
100, x:150});
View.scene.addChild(cube);

// add a huge surrounding sphere so we really can see what we’re doing
var largeSphere:Sphere = new Sphere({radius:
1500,material:”yellow#black”});
largeSphere.invertFaces();
View.scene.addChild(largeSphere);

cam.hover();
View.render();

// only run when user is above the SWF
cover = new Cover(this);
addChild(cover);

this.stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDown);
this.stage.addEventListener(KeyboardEvent.KEY_UP,keyUp);
this.addEventListener(Event.ENTER_FRAME,onEnterFrame);

// Listen for clicks on the objects
sphere.addEventListener(MouseEvent3D.MOUSE_DOWN,objectClick);
cone.addEventListener(MouseEvent3D.MOUSE_DOWN,objectClick);
cube.addEventListener(MouseEvent3D.MOUSE_DOWN,objectClick);
}

private function onEnterFrame(e:Event):void
{
if(!cover.visible)
{
if(keyIsDown){
// if the key is still pressed, just keep on moving
switch(lastKey){
case 87  : cam.targettiltangle -= 10; break;
case 83  : cam.targettiltangle += 10; break;
case 65  : cam.targetpanangle -= 10; break;
case 68  : cam.targetpanangle += 10; break;
}
}
// render the view
cam.hover();
View.render();
}
}
private function keyDown(e:KeyboardEvent):void
{
lastKey = e.keyCode;
keyIsDown = true;
}
private function keyUp(e:KeyboardEvent):void
{
keyIsDown = false;
}
private function objectClick(e:MouseEvent3D):void
{
var obj:Object3D = e.target as Object3D;
cam.target = obj;
}
}
}

//**********************************************//

I am getting error

//********************************//

1119: Access of possibly undefined property targetpanangle through a
reference with static type away3d.cameras:HoverCamera3D.

1046: Type was not found or was not a compile-time constant: Cover.

//*********************************//

I tried to use different older libraries then I got other errors like

//********************************//

Description     Resource        Path    Location        Type
1046: Type was not found or was not a compile-time constant:
SkinVertex.     Geometry.as /away3dFirst/src/away3d/core/base   line 348
Flex Problem

//******************************//

Now I am really confused about away3D is it stable or not yet stable I
almost used all previous version from 2.2.0 to 3.5.0 and getting
different types of errors.

can anybody point me in right direction or tell me what I am doing
wrong ?

Thanks,
Riyasat

Reply via email to