Hi all
I have played around with away3d a bit now.
My code is fairly simple. And it works when testing in the Flash Professional CS6 ide.
As soon as I deploy to my iPad 2 and try and run it all I get is a black screen.
I had to modify the code in View3D.as so that it would run (found this solution on this site)
private function updateBackBuffer() : void
{
_stage3DProxy.configureBackBuffer(_width, _height, _antiAlias, false); // changed to false to prevent an error occurring.
_backBufferInvalid = false;
}
Here is the actual code:
package {
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.events.LoaderEvent;
import away3d.lights.DirectionalLight;
import away3d.loaders.Loader3D;
import away3d.loaders.misc.AssetLoaderContext;
import away3d.materials.ColorMaterial;
import away3d.primitives.Cone;
import away3d.primitives.Sphere;
import away3d.loaders.parsers.Parsers;
import flash.utils.setTimeout;
import flash.display.MovieClip;
import flash.events.Event;
import flash.net.URLRequest;
public class Hello3Dworld extends MovieClip {
private var mView:View3D;
private var _loader:Loader3D;
private var cone:Cone;
public function Hello3Dworld() {
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function onRemovedFromStage(e:Event):void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeChild(mView);
mView.dispose();
cone = null;
mView = null;
}
private function onAddedToStage(e:Event):void
{
mView = new View3D();
mView.backgroundColor = 0x00FF00;
//mView.antiAlias = 4;
this.addChild(mView);
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
cone = new Cone(new ColorMaterial(0xFF0000));
mView.scene.addChild(cone);
}
private function onEnterFrame(e:Event):void
{
cone.rotationY++;
cone.rotationX += 1.3;
mView.render();
}
}
}
Any ideas what might be wrong?