I don’t get it. 

Software: Away3D 3.x

Smoke Fumus, Newbie
Posted: 05 September 2011 03:40 PM   Total Posts: 1

Can somebody explain me what am i doing wrong? This one does not show anything.

package
{
 import away3d
.debug.AwayStats;
 
import away3d.cameras.*;
 
import away3d.containers.*;
 
import away3d.core.base.*;
 
import away3d.core.utils.*;
 
import away3d.events.*;
 
//import away3d.loaders.*;
 
import away3d.loaders.Obj;
 
import away3d.loaders.LoaderCube;
 
import flash.display.*;
 
import flash.events.*;
 
 public class 
awayviewer extends Sprite
 {
  
private var loader:LoaderCube;
  private var 
model:ObjectContainer3D;
  
//scene objects
  
private var objecter:Obj
  
//engine variables
  
private var scene:Scene3D;
  private var 
camera:HoverCamera3D;
  private var 
view:View3D;
  
//ferrari texture
  
[Embed(source="assets/bomber.png")]
  
private var texturator:Class;
  
  
//material objects
  
private var materialArray:Array;
  private var 
materialIndex:int 0;  
  
[Embed (source="metal.jpg")private var myTexture:Class;
  private var 
myBitmap:Bitmap = new myTexture();
  
//"http://dl.dropbox.com/u/9288177/CSE/BADASS.obj"
  
public function Basic_LoadModel():void
  {
   Debug
.active true;
   
init();
  
}
  
  
//**
  // * Global initialise function
  
  
private function init():void
  {
   initEngine
();
   
initMaterials();
   
initObjects();
   
initListeners();
  
}
  
  
public function initEngine():void
  {
   scene 
= new Scene3D();
   
   
camera = new HoverCamera3D();
   
camera.panAngle 45;
   
camera.tiltAngle 20;
   
camera.hover(true);
   
   
//view = new View3D({scene:scene, camera:camera});
   
view = new View3D();
   
view.scene scene;
   
view.camera camera;
   
   
//view.addSourceURL("srcview/index.html");
   
addChild(view);
      
   
addChild(new AwayStats(view));
   
   
  
}
  
private function initMaterials():void
  {
   materialArray 
[Cast.material(texturator)];
  
}
  
  
private function initObjects():void
  {
   
//loader = Max3DS.load("assets/f360.3ds", {loadersize:200, centerMeshes:true, material:materialArray[materialIndex]}) as LoaderCube;
   
objecter = new Obj();
   
objecter.centerMeshes true;
   
objecter.material materialArray[materialIndex];
   
   
loader = new LoaderCube();
   
loader.loaderSize 200;
   
loader.addOnSuccess(onSuccess);
   
loader.loadGeometry("http://dl.dropbox.com/u/9288177/CSE/BADASS.obj"objecter);
   
   
scene.addChild(loader);
  
}
  
private function initListeners():void
  {
   addEventListener
(Event.ENTER_FRAMEonEnterFrame);
  
}
  
  
  
private function onEnterFrame(event:Event):void
  {
   loader
.handle.rotationY += 2;

   
camera.hover();
   
view.render();
  
}
  
private function onSuccess(event:Event):void
  {
   model 
loader.handle as ObjectContainer3D;
   
model.scale(100);
   
   
model.rotationX 0;
  
}
  
  
 } 
   

Avatar
kurono, Sr. Member
Posted: 05 September 2011 03:48 PM   Total Posts: 103   [ # 1 ]

Add consructor for your class.

public function awayviewer():void {
     init
();

or simply replace “awayviewer” to “Basic_LoadModel”.

   

Smoke Fumus, Newbie
Posted: 05 September 2011 03:53 PM   Total Posts: 1   [ # 2 ]
kurono - 05 September 2011 03:48 PM

Add consructor for your class.

public function awayviewer():void {
     init
();

tongue rolleye doh, sorry for disturbing, I’m a new into AS.
Now it shows loading-cube…aaaand all.  By the way, syntax done right?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X