I am trying to create a click and drag function for the camera for skybox but I am having an issue with undefined properties not being accessed, I believe I am missing an import statement but I cannot remember what it was that I needed.
Errors that I am having,
Access of undefined property mouseUpHandler.
Access of undefined property mouseDownHandler
Access of undefined property onResize
Call to a possibly undefined method onResize.
import away3d.cameras.lenses.*;
import away3d.cameras.Camera3D;
import away3d.containers.*;
import away3d.entities.*;
import away3d.materials.*;
import away3d.materials.methods.*;
import away3d.primitives.*;
import away3d.textures.*;
import away3d.utils.*;
import away3d.containers.View3D;
import away3d.controllers.HoverController;
import flash.display.*;
import flash.events.*;
import flash.geom.Vector3D;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.ui.Keyboard;
function initListeners():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
view.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
view.addEventListener(MouseEvent.MOUSE_UP, mouseDownHandler);
stage.addEventListener(Event.RESIZE, onResize);
onResize()
cameraController = new HoverController(camera, null, 45, 30, 520, 5);
}
private function onEnterFrame(event:Event):void
{
if (move){
cameraController.panAngle = 0.3*(stage.mouseX - lastMouseX) + lastPanAngle;
cameraController.tiltAngle = 0.3*(stage.mouseY - lastMouseY) + lastTiltAngle;
}
function mouseDownHandler(event:MouseEvent):void{
move = true;
lastPanAngle = cameraController.panAngle;
lastTiltAngle = cameraController.tiltAngle;
lastMouseX = stage.mouseX;
lastMouseY = stage.mouseY;
stage.addEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
function mouseUpHandler(event:MouseEvent):void{
move = false;
stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
function onStageMouseLeave(event:Event):void
{
move = false;
stage.removeEventListener(Event.MOUSE_LEAVE, onStageMouseLeave);
}
function onResize (event:Event = null):void
{
view.width = stage.stageWidth;
view.height = stage.stageHeight;
//awayStats.x = stage.stageWidth - awayStats.width;
}