Simple 3d spinning cone not working on IOS

Software: Away3D 4.x

Slurpy, Newbie
Posted: 29 May 2012 08:44 AM   Total Posts: 2

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_antiAliasfalse); // 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_STAGEonAddedToStage);   
   
addEventListener(Event.REMOVED_FROM_STAGEonRemovedFromStage);
  
}
  
  
private function onRemovedFromStage(e:Event):void 
  {
   removeEventListener
(Event.ENTER_FRAMEonEnterFrame); 
   
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_FRAMEonEnterFrame); 
   
     
   
   
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?

   

Richard Olsson, Administrator
Posted: 16 June 2012 01:36 PM   Total Posts: 1192   [ # 1 ]

Is this working when you run it in the AIR simulator?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X