Hello,
I’m loading a 3ds model, (created / exported from Blender 2.6x) using Loader3D.
This is all working, I can see the model in flash as expected. Shapes, Colors, A-OK.
However if I try to change a mesh’s material from ColorMaterial into TextureMaterial the movie stops working.
The default material type is always ColorMaterial when I check on import, even if I assign a Texture in Blender.
here is the relevant LoadComplete handler I use (important parts only)
private function onModelCompleted(event:LoaderEvent):void
{
var mesh1:Mesh;
trace(“model loaded”+_loader.numChildren);
for (var n:int = 0; n < _loader.numChildren;n++ )
{
mesh1 = _loader.getChildAt(n) as Mesh;
//This is always working, I can assign color material at will!!
mesh1.material = new ColorMaterial(0xFF0000);
//This will not work, WHY?
mesh1.material = new TextureMaterial(new BitmapTexture((new texCaRed()).bitmapData));
}
}
The TextureMaterial itself is working fine, I can assign it to a simple Plane or Sphere just fine.
Am I missing something or is it not possible to change the the TYPE of a material once set? If so, how can I tell the 3ds file to use TextureMaterial up front?
Anyone any ideas what I am doing wrong?
Regards
Andreas