|
How to... 3D Buttons
Using 3d objects as buttons can really help to emphasize features of a 3d product. Detecting when the user has his mouse over one particular part of your 3d is straightforward, and your response can be anything you can imagine within the power of the Blaze player. The key is a little known property of MovieClip - objectTrackingEnabled. Set this property to true for your 3d movie clip and you get access to the MovieClip method getSceneObject(xpos: Number, ypos: Number): SceneObject. Here, xpos and ypos are Stage coordinates. The objectTrackingEnabled flag must be set at least one frame before you want to use getSceneObject. So, if you want to check for the user's mouse rolling over one of your 3d objects each frame, add this to frame 1 of your movie: mc3d.objectTrackingEnabled = true; (where mc3d is the name of your 3d movie clip). Then have a movie clip run an enterFrame event: onClipEvent(enterFrame)
{
if (_root.mc3d.getSceneObject(_root._xmouse, _root._ymouse) == _root.mc3d.button1)
{
//the mouse is over the scene object called button1
changeButton1();
}
}Of course the function changeButton1() can do anything. Change a texture map on the button1 object, display some text describing the feature, play a 3d animation, make the whole object invisible. This example uses 3d buttons to good effect (press the button with the question mark on the left side). The buttons themselves are deliberately made visible additions to the model. This makes clear every feature that the user can choose. When the mouse is detected over a button, it changes colour and a description appears in the box above. |