all depends on the way the material has been previously set: at face
or object level
if you want to change material set at object level
mesh.material = new material // or just the bitmap (mesh.material as
bitmapmaterial).bitmap = myNewBitmapdata;
or if the parser of via code material has been assigned by faces
parse all the faces to change the materials if more than one is set
or just in case its assigned by faces but there is only one
like (mesh.faces[0].material as BitmapMaterial).bitmap =
myNewBitmapdata;
or access if applicable the parser.materialdata
Fabrice
On Nov 30, 2009, at 4:21 PM, Jochem Neerhof wrote:
Is it possible that I can't retrieve bitmapData if an image location
is given in an XML file?
Embedding the image shows no problems, but if i try to load an image
with an XML file it seems to lose its data.
Jochem
On 30 nov, 12:37, Jochem Neerhof <[email protected]> wrote:
Thank for your fast replies. I'll give both ways a try.
Jochem
On 30 nov, 11:48, Fabrice3D <[email protected]> wrote:
The AS3 classes generated by Prefab and Away3D also hold a meshes
array.
so if you know which one is the target
you also can change your material with
(myclass.meshes[index].material as BitmapMaterial).bitmap =
myNewBitmapdata;
Fabrice
On Nov 30, 2009, at 11:28 AM, lo-th wrote:
Hi
for me the best way to change material is
C_MAP({ obj:your_objet3d, clip:your_Bitmapdata , type:"bitmap",
s:true})
function C_MAP( ini:Object ):void{
MAP( ini ); var mat:*= ini['mat'] ;
ini['mat'].smooth=ini["s"] || false;
var M= ini['obj'] as Mesh
for each (var F:Face in M.faces){ if(F)F.material=mat }
}
// only for primitive object
function C_MAP2( ini:Object ):void{
MAP( ini ); var mat:*= ini['mat'] ;
ini['mat'].smooth=ini["s"] || false;
var M= ini['obj'] as Mesh
M.material=(mat)
}
// material in away lite
public function MAP( ini:Object ):void{
switch(ini['type']){
case "bitmap": ini['mat'] = new BitmapMaterial( ini['clip'] );
break;
case "color": ini['mat'] = new ColorMaterial (ini['color'] ||
0x00 ,ini['alpha'] || 1 ); break;
case "null": ini['mat'] = new ColorMaterial (0x00, 0);break;
case "wire": ini['mat'] = new WireframeMaterial( ini['color']
||
0x00) break;
case "movie": ini['mat'] = new MovieMaterial(ini['clip']); break;
}}