Hi all. I need some help. I have no idea what’s causing this.
I’m using FlashDevelop (latest version), Away3D 4.0.0 Beta, Flash 11.2. When I have even a simple Away3D scene going, hold down any key, and move the mouse, my framerate starts dropping. There doesn’t even have to be anything in the handler functions. I’m at my wits’ end here. Someone please throw me a bone.
Code below, pic of my frames dropping here:
http://postimage[dot]org/image/f5809rx45/
package
{
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.debug.AwayStats;
import away3d.entities.Mesh;
import away3d.materials.ColorMaterial;
import away3d.primitives.CubeGeometry;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.geom.Vector3D;
/**
* ...
* @author
*/
[SWF(width = "800", height = "600", frameRate = "60", backgroundColor = "#000000")]
public class Main extends Sprite
{
private var _view:View3D;
private var _cam:Camera3D;
private var _scene:Scene3D;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
_cam = new Camera3D();
_scene = new Scene3D();
_view = new View3D();
_view.scene = _scene;
_view.camera = _cam;
_cam.z = -1000;
_cam.lookAt(new Vector3D());
addChild(_view);
addChild(new AwayStats(_view));
var m:Mesh = new Mesh(new CubeGeometry(), new ColorMaterial(0xFFFFFF));
_scene.addChild(m);
this.addEventListener(KeyboardEvent.KEY_DOWN, keyHandlerDown);
this.addEventListener(KeyboardEvent.KEY_UP, keyHandlerUp);
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void {
_view.render();
}
private function keyHandlerDown(e:KeyboardEvent):void {
}
private function keyHandlerUp(e:KeyboardEvent):void {
}
}
}
Edit: posted shorter link to image