Hello gurus,
Here’s a work-in-progress game tile I’m working on with rollover and clicking changes. The mesh is expanding a touch on a Prefab3D export.:
http://www.christopherstevens.cc/away3d/tile2/
A nice RimLightMethod could be a cool addition to highlight tiles. I’m having trouble though getting one assigned to my tile mesh, which seems to be a “MaterialBase”.
Example:
...
private function initContent():void
{
_prefabOutput = new Tile2();
_view.scene.addChild(_prefabOutput);
_mouseOverSpecularMethod = new RimLightMethod( 0xA4F4FE, .4, 2, "mix" ); //ok so far
_prefabOutput.materials[0].specularMethod = _mouseOverSpecularMethod; //results in error
_prefabOutput.meshes[0].mouseEnabled = true;
_prefabOutput.meshes[0].addEventListener( MouseEvent3D.MOUSE_OVER, onTileMouseOver );
_prefabOutput.meshes[0].addEventListener( MouseEvent3D.MOUSE_OUT, onTileMouseOut );
_prefabOutput.meshes[0].addEventListener( MouseEvent3D.MOUSE_DOWN, onTileMouseDown );
_camera.lookAt(_prefabOutput.position);
}
...
Error:
1119: Access of possibly undefined property specularMethod through a reference with static type away3d.materials:MaterialBase.
Would it be better to take this tile outside of the Prefab3D defaults with a new class and no helper functions, creating materials from scratch. Or, am I missing something?
Thanks for the assist.