Thanks for the response. The code is below. It checks if a terrain exists, if not, it creates it. That’s fine. However, I dont know how to properly update the created Elevation with the new texture and new heightmap.
I really appreciate the help.
// Create the new texture
var leTxtr:BitmapData = new BitmapData(2048, 2048, false, 0x00000000);
leTxtr.draw(mapImgCon);
var terrainMaterial:TextureMaterial = new TextureMaterial(new BitmapTexture(leTxtr));
terrainMaterial.ambientColor = 0x303040;
terrainMaterial.ambient = .5;
terrainMaterial.specular = 0; terrainMaterial.addMethod(globals.vars.fogMethod);
//create the heightmap
var leHMap:BitmapData = new BitmapData(2048, 2048, false, 0x00000000);
leHMap.draw(mapHgtCon);
// Check if there is a terrain present
if (terrain == false)
{
terrain = new Elevation(terrainMaterial, leHMap, 2048, 38, 2048, 250, 250, 255, 0, false);
terrain.name = 'tile';
terrain.y = -9;
addChild(terrain);
}
else
{
// If the terrain already exists, change the texture and the heightmap with the new texure and heightmap
/* This is the area with the problem. I dont know how to change the texture and/or the heightmap, and have the 3D terrain to update */
terrain.material = terrainMaterial;
trace('elevation updated');
}