Not sure if this is an Away3D error?
Created an ActionScript Mobile project in Flash Builder 4.6. Followed the steps to overlay AIR 3.4 SDK in a project with the code as follows:
package{
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.controllers.HoverController;
import away3d.loaders.Loader3D;
import away3d.loaders.parsers.Parsers;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Vector3D;
import flash.net.URLRequest;
[SWF(backgroundColor="#000000", frameRate="60")]
public class Gyro7 extends Sprite {
private var _view:View3D;
private var _scene:Scene3D;
private var _camera:Camera3D;
private var _loader:Loader3D;
private var hoverController:HoverController;
private var _prevMouseX:Number;
private var _prevMouseY:Number;
private var _angleX:Number = 0;
private var _angleY:Number = 0;
private var _angleZ:Number = 0;
public function Gyro7(){
Parsers.enableAllBundled();
setup3d();
}
private function setup3d():void{
stage.scaleMode = StageScaleMode.EXACT_FIT;
_view = addChild(new View3D()) as View3D;
_view.antiAlias = 4;
_view.width = 400;
_view.height = 300;
_scene = _view.scene;
_camera = _view.camera;
_camera.lens.far = 5000;
_camera.lens.near = 20;
hoverController = new HoverController(_camera);
hoverController.tiltAngle = 0;
hoverController.panAngle = 180;
hoverController.minTiltAngle = -60;
hoverController.maxTiltAngle = 60;
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageMouseDown);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMove);
stage.addEventListener(MouseEvent.MOUSE_WHEEL, onStageMouseWheel);
_loader = new Loader3D(true, null);
_loader.load( new URLRequest("model/Character.AWD"));
_loader.scaleX = _loader.scaleY = _loader.scaleZ = 10;
_loader.y = -250;
_loader.x = 100;
_scene.addChild( _loader );
addEventListener( Event.ENTER_FRAME, render );
}
private function onStageMouseDown(event:MouseEvent):void{
_prevMouseX = event.stageX;
_prevMouseY = event.stageY;
}
private function onStageMouseMove(ev:MouseEvent):void{
if (ev.buttonDown) {
hoverController.panAngle += (ev.stageX - _prevMouseX);
hoverController.tiltAngle += (ev.stageY - _prevMouseY);
}
_prevMouseX = ev.stageX;
_prevMouseY = ev.stageY;
}
private function onStageMouseWheel(ev:MouseEvent):void{
hoverController.distance -= ev.delta * 5;
if (hoverController.distance < 100){
hoverController.distance = 100;
}
else if (hoverController.distance > 2000){
hoverController.distance = 2000;
}
}
private function render( e:Event ):void{
_camera.lookAt(new Vector3D());
_view.render();
}
}
}
I’ve been able to run this project successfully on my phone, but after closing out the app and making changes an ‘An internal build error has occurred. See the log for more information” error pops up and then if I do a Project Clean, the Error: 1131: Classes must not be nested comes up at line: “public class Gyro7 extends Sprite {”.
Next Post has Error Log