Author Topic: quad texture error while scene instantiation  (Read 796 times)

elhussein ali   «   on: February 12, 2017, 08:43:19 AM »
while i was go to create a new Scene3D object

new Scene3D(myContainer);

it was raise the following error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at flare.materials::QuadMaterial/set texture()[Z:\projects\flare3d 2.5\src\flare\materials\QuadMaterial.as:37]
   at flare.materials::QuadMaterial()[Z:\projects\flare3d 2.5\src\flare\materials\QuadMaterial.as:24]
   at flare.basic::Scene3D()[Z:\projects\flare3d 2.5\src\flare\basic\Scene3D.as:235]
   

why ?

elhussein ali   «   Reply #1 on: February 12, 2017, 12:59:54 PM »
the error was raised while creating the Scene3D in function that called at button click

Code: [Select]
private function btn_click(MouseEvent.CLICK):void {
 
  try {
    var s:Scene3D = new Scene3D(myContainer);

  } catch (err:Error) {
    trace(err, err.getStackTrace());
  }

}

i found work around through invoking the following code at Main function

Code: [Select]
  // !!!!!
  // just to avoid the scene3d error
  new Scene3D(stage).dispose();

but still not satisfy by that !!!

Ariel Nehmad   «   Reply #2 on: February 15, 2017, 01:05:31 PM »
If you create the scene inside a function, that reference it is likely to be deleted by the garbage collector at some point. Don't do that, create a local class reference instead.
Also if you create the scene on a button click, make sure you're not creating more than one.

Tags: