Null object reference in View3D

Software: Away3D 4.x

bo, Newbie
Posted: 03 June 2012 09:29 PM   Total Posts: 3

Dear all, i’m trying to generate my first mesh. Whene i run the application (Adobe AIR Flex 6) the following error occurs:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at away3d.containers::View3D/updateBackBuffer()[/Volumes/WORK/Progetti/Mach-3d/workspace/Away3d/src/away3d/containers/View3D.as:460]


Following the code that generate the error. Of course i’m missing something. Who can help me please?

public function renderer():View3D{
 
var _view  :View3D  = new View3D();
 var 
_colorMaterial :ColorMaterial = new ColorMaterial(0xffffff);
 var 
_uvs   :Vector.<Number>  = new Vector.<Number>;
 var 
_vertices  :Vector.<Number>  = new Vector.<Number>;
 var 
_triangle   :LPGM_8_Triangle    null;
 var 
_vertex    :LPGM_8_Vertex  null;
 var 
_subGeometry :SubGeometry   = new SubGeometry();
 var 
_geometry  :Geometry    = new Geometry();
 var 
_lpMesh   :Mesh     null;
 var 
_indices  :Vector.<uint>  = new Vector.<uint>;
   
 
_colorMaterial.smooth true;
 
_colorMaterial.bothSides true;
 
_colorMaterial.diffuseMethod.alphaThreshold .3;
 
_colorMaterial.ambient .2;
   
 
//Generate array of vertices setting center of the model in the origin of the image
 
for(var i:int=0i<_lpgmmodel.vertices.lengthi++){
  trace
(i);
  
_vertex  _lpgmmodel.getVertexByIndex(i);
  
_vertices.push(
   (
_vertex.x-(_userimage.width/2.0)), 
   ((
_userimage.height/2.0)-_vertex.y), 
   
_vertex.z
  
);
 
}
   
   
   
for each(var value:* in _lpgmmodel.triangles{
    _triangle 
LPGM_8_Triangle(value);
    
_indices.push
     
_triangle.vertex1.id
     
_triangle.vertex2.id
     
_triangle.vertex3.id
    
);
   
}

   
   _subGeometry
.updateVertexData(_vertices);
   
_subGeometry.updateIndexData(_indices);
   
_subGeometry.autoDeriveVertexTangents  true;
   
_subGeometry.autoDeriveVertexNormals true
   _geometry
.addSubGeometry(_subGeometry);
   
_lpMesh = new Mesh(_geometry_colorMaterial);
   
_view.scene.addChild(_lpMesh);
   
   
   return 
_view
   

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

You say you’re using “Adobe AIR Flex 6”. I’m not sure what this means. What version of AIR are you using, and what version of the Flex SDK? AIR needs to be at least 3.2, and Flex should be 4.6. Make sure you’re targeting Flash Player 11 APIs.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X