MouseEvent + KeyboardEvent = awful framerate??

Software: Away3D 4.x

synkarius, Member
Posted: 15 April 2012 01:16 AM   Total Posts: 64

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 (stageinit();
   else 
addEventListener(Event.ADDED_TO_STAGEinit);
  
}
  
  
private function init(e:Event null):void 
  {
   removeEventListener
(Event.ADDED_TO_STAGEinit);
   
// entry point
   
   
_cam = new Camera3D();
   
_scene = new Scene3D();
   
_view = new View3D();
   
   
_view.scene _scene;
   
_view.camera _cam;
   
   
_cam.= -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_DOWNkeyHandlerDown);
   
this.addEventListener(KeyboardEvent.KEY_UPkeyHandlerUp);
   
this.addEventListener(Event.ENTER_FRAMEonEnterFrame);
  
}
  
  
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

   

synkarius, Member
Posted: 17 April 2012 06:08 AM   Total Posts: 64   [ # 1 ]

Update: This only happens when I set the framerate to 60FPS. 30 works fine, no slowdown. Lowering the framerate isn’t really a satisfactory solution though.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X