Changing material or texture of a Loader3D

Software: Away3D 4.x

andreahmed, Member
Posted: 10 October 2013 12:14 PM   Total Posts: 62

Hi All,

Is there a way to change/update the material of any loader3d at game loop?

In all examples they are set during initializations ( onAssetLoader).

   

andreahmed, Member
Posted: 10 October 2013 12:22 PM   Total Posts: 62   [ # 1 ]

Fixed

here is the solution

TweenMax.delayedCall(4onFinish);
  function 
onFinish():void
  {
   
if ( loader[0])
   
{
    
var mesh:Mesh Mesh(loader[0].getChildAt(0));
    
trace(mesh.z);
   
}
  } 

The delay because the scene is not fully loaded with the models.

   

Mr Margaret Scratcher, Sr. Member
Posted: 31 March 2014 08:40 PM   Total Posts: 344   [ # 2 ]

A better way to do it would be something like this:

fileLoader.addEventListener(LoaderEvent.RESOURCE_COMPLETEaddOBJ);
   
  
}
  
function addOBJ(e:Event):void
  {
   trace 
("adding OBJ");
   
view.scene.addChild(fileLoader);
   
    for (var 
int 0fileLoader.numChildren; ++i
    
{
     
var mesh Mesh(fileLoader.getChildAt(i));
     
     
     
mesh.material someMaterial;
    
}
  } 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X