The answer came in a flash of inspiration

mug.children[0].children[0].faces[currentPolygonIndex].material =
greenMatterial;




On Jul 3, 1:18 pm, datafake <[email protected]> wrote:
> Hi all,
>
> I want to be able to access the faces data for a loaded kmz file and
> change the material for specific polygons. I can do this if I start
> with a primitive like so.
>
> centerCube = new Cube({material:greenMatterial, width:200, height:200,
> depth:20});
> var away3DMaterial:BitmapMaterial = new BitmapMaterial(Cast.bitmap
> (away3DBitmap), {smooth:true, precision:1});
> // put a bitmap on one side of the cube
> centerCube.faces[0].material = away3DMaterial;
> centerCube.faces[1].material = away3DMaterial;
>
> However I cant seem to do the same thing with a loaded kmz 4 object
> ( a 'mug' created in sketchup )
>
> code such as
>
>  mug.faces
>
> or
>
> mug.children[0].faces
>
> or
>
> var obj:Mesh = (mug.children[0] as Mesh);
> trace("faces:"+obj.faces);
>
> All fail with errors saying faces is null.
>
> I want to be able to alter uv coords and apply a bitmap to an area of
> polygons on the loaded model. I have my reasons for not using the
> authoring tool to place the texture
>
> Can anybody tell me how to get access to a kmz's polygon and uv data.
>
> Thanks for your help
>
> Graeme

Reply via email to