Hi,
I have a scene with a primitive within a Container3D and wish to be able to use the MouseWheel event for Zoom In/Out such container.
The fact is that I can not guess how to accomplish this.
I have the following code:
private function MouseWheel(event:MouseEvent):void {
var distance_old:Number = distance;
distance -= event.delta*4;
if ( (distance - camera.distance) / zoomSpeed > 0 ) {
container.scaleX=container.scaleY=container.scaleZ = (distance - camera.distance) / zoomSpeed;
} else distance = distance_old;
}
But the transitions when moving the wheel are strong and Horrible and sometimes do not work. The behavior is strange.
What’s wrong?