hi, ich hab folgendes Problem, ich habe einen Würfel und möchte den wenn man drauf klickt drehen lassen, leider funktioniert meine Bastelei net
ich benutze CS4 und AS3
hat jemand eune idee??
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.special.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.special.*;
import org.papervision3d.materials.shaders.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.lights.*;
import org.papervision3d.render.*;
import org.papervision3d.view.*;
import org.papervision3d.events.*;
import org.papervision3d.core.utils.*;
import org.papervision3d.core.utils.virtualmouse.VirtualMouse;
import org.papervision3d.events.MouseEvent3D;
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
import org.papervision3d.core.math.Number3D;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.core.math.Matrix3D; //DREHEN
import org.papervision3d.core.proto.CameraObject3D; //ZOOMEN
var viewport:Viewport3D = new Viewport3D(0, 0, true, true);
addChild(viewport);
viewport.buttonMode = true;
var renderer:BasicRenderEngine = new BasicRenderEngine();
var scene:Scene3D = new Scene3D();
var camera:Camera3D = new Camera3D();
camera.zoom = 6;
camera.focus = 100;
var mam:MovieMaterial = new MovieMaterial(face);
mam.interactive = true;
mam.smooth = true;
mam.animated = true;
var mam2:MovieMaterial = new MovieMaterial(face2);
mam2.interactive = true;
mam2.smooth = true;
mam2.animated = true;
var mam3:MovieMaterial = new MovieMaterial(face3);
mam3.interactive = true;
mam3.smooth = true;
mam3.animated = true;
var mam4:MovieMaterial = new MovieMaterial(face4);
mam4.interactive = true;
mam4.smooth = true;
mam4.animated = true;
var mam5:MovieMaterial = new MovieMaterial(face5);
mam5.interactive = true;
mam5.smooth = true;
mam5.animated = true;
var mam6:MovieMaterial = new MovieMaterial(face6);
mam6.interactive = true;
mam6.smooth = true;
mam6.animated = true;
// DREHEN & ZOOMEN
puplic class cube extends BasicView
{
private static const FORWARD:Number3D = new Number3D(0, 0, 1);
private var cube:Cube;
private var previousMousePoint:Point = new Point();
private var isMouseDown:Boolean = false;
public function cube()
{
var light:PointLight3D = new PointLight3D();
var flatShadeMaterial:FlatShadeMaterial = new FlatShadeMaterial(light, 0xcc0000, 0x222222);
cube = new Cube(new MaterialsList({front:mam, back:mam2, left:mam3, right:mam4,top:mam5, bottom:mam6}), 520, 520, 520, 10, 10, 10);
scene.addChild(cube);
startRendering();
stage.addEventListener(MouseEvent.MOUSE_DOWN, stage_mouseDownHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, stage_mouseUpHandler);
}
private function stage_mouseDownHandler(event:MouseEvent):void
{
isMouseDown = true;
}
private function stage_mouseUpHandler(event:MouseEvent):void
{
isMouseDown = false;
}
override protected function onRenderTick(event:Event=null):void
{
var currentMousePoint:Point = new Point(viewport.containerSprite.mouseX, viewport.containerSprite.mouseY);
if(isMouseDown)
{
var difference:Point = currentMousePoint.subtract(previousMousePoint);
alXX-=difference.y/150;
rotationMatrix1 = Matrix3D.rotationMatrix(1,0,0, -difference.y/150);
rotationMatrix2 = Matrix3D.rotationMatrix(0, Math.cos(alXX), Math.sin(alXX), -difference.x/150);
rotationMatrix= Matrix3D.multiply3x3 (rotationMatrix2,rotationMatrix1);
triangleMesh3d.transform.calculateMultiply3x3(rotationMatrix, triangleMesh3d.transform);
}
previousMousePoint = currentMousePoint;
super.onRenderTick(event);
}
}
face2.addEventListener(MouseEvent.CLICK, face2Click);
function face2Click(e:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.google.com"));
}
face3.addEventListener(MouseEvent.CLICK, face3Click);
function face3Click(e:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.flickr.com"));
}
face4.addEventListener(MouseEvent.CLICK, face4Click);
function face4Click(e:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.youtube.com"));
}
face5.addEventListener(MouseEvent.CLICK, face5Click);
function face5Click(e:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.facebook.com"));
}
face6.addEventListener(MouseEvent.CLICK, face6Click);
function face6Click(e:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.adobe.com"));
}
FEHLER:
Zeile 83-> 1023: Nicht zulässiges außer Kraft Setzen.
****public function cube()****
Zeile 83 -> 1021: Doppelte Funktionsdefinition.
****public function cube()****
Zeile 74 -> 1116: Ein benutzerdefiniertes Namespace-Attribut kann nur auf der obersten Ebene einer Klassendefinition verwendet werden.
****puplic class cube extends BasicView****
Zeile 74 -> 1131: Klassen dürfen nicht verschachtelt werden.
****puplic class cube extends BasicView****
kann mir jemand helfen