Binding Scripts to GUI Objects

Let's assume you have to create animations so that there is a key frame in every 5fth frame.

1. Open the Environments/Customization/Available Objects window.

2. Go to the Macros tab. Click the Macro button. The lower part of the window shows you now the macro button specific options.

3. Set the Command Language field to JavaScript. You can now enter the desired program into the text control. Enter the following text:

    layerlist = GetJS("");
    currentproject = layerlist.GetCurrentLayer();
    animator = currentproject.GetAnimator();
    frame = animator.GetCurrentFrame();
    frame = frame + 5;

4. Enter an appropriate name and a tool tip for the button (such as 'Jump 5'). You might also want to paint a nice icon for the button using your favorite painting program. Then select it using the Image browse button of the macro button controls.

5. Drag & drop the macro button icon into the toolbar.

Every time you click the macro button, the animation time is increased by 5 frames.