Li, thanks, great tip, but in my case the object's materialLibrary is
empty.  I see that in its constructor buildMaterials() is called but
it does not seem to load any materials into materialLibrary.

Maybe we need to go back and look more closely how we originally used
AS3Exporter to make the object.

By any chance would you happen to have a complete example of
generating an AS3 from a Collada file and changing its material later?
Or do you know if someone has a tutorial on this?  (Hint to Fabrice!)

Thanks again- Ralph

On Jul 5, 9:42 am, Li <[email protected]> wrote:
> Ok, now its clearer =)
>
> I remember doing something similar one. I had one AS3 generated object and
> needed to use various copies of it with different material applications. The
> structure of a generated object can be pretty complex, what you have is a
> bunch of meshes and a bunch of materials and each material can be applied to
> multiple meshes.
>
> So, you can do something like this:
>
> for each(var mdata:MaterialData in obj.materialLibrary)
> {
>      if(mdata.name == "theOneImLookingFor")
>           mdata.material = new WireColorMaterial();
>
> }
>
> I'm not sure about "if(mdata.name == "theOneImLookingFor")", but you can use
> any properties of material data to identify what you are looking for. Once
> the material in the material data object is changed, all the meshes that
> were linked to such mdata will be updated with your new material, without
> you caring to id the meshes themselves.
>
> Hope it helps,
> Li

Reply via email to