In my last post here I was working with the assignment of dynamic
materials to custom-defined objects, but I think this was a bit
premature for my understanding, so here I'm asking a question about
only one piece of my problem:

I would like to create a custom mesh (a flat plane cutout, really) and
apply *one* material stretched across all the faces in the cutout (the
way it is when a texture is applied to a sphere for example).  This is
what I tried:

// In class
[Embed(source="C:/pic.jpg")]
public var earthBitmap:Class;

// In function
var texturedShape:Mesh = new Mesh();
var f:Face = new Face( v1a, v2a, v3a );
var f2:Face = new Face( v1b, v2b, v3b );
texturedShape.addFace(f);
texturedShape.addFace(f2);
texturedShape.material = new PhongBitmapMaterial( Cast.bitmap
(earthBitmap) );
_scene.addChild( texturedShape );

However, this results in the entire screen going black when the face
is in view of the camera.  The problem also occurs when only one face
is used.  Please can you tell me what is the correct way to apply an
embedded texture to one face, or across multiple faces of a single
mesh?  This will help me very much.

Thank you!




PS: Ideally I would have created only one surface with slanted edges
to create the shape I want, but I believe the only way to do it is
with individual faces, so this is the method that I'm currently using
even though it results in tiny spaces between a couple of the faces
which I have not found a way to get rid of yet.

Reply via email to