Contents

Working with Inputs and Forms Holding Buttons

Controlling Frames with JavaScript

Normally the properties of each frame are set using the timeline when the movie is playing. For more complex animation, the timeline can be turned off, and JavaScript can be used instead. Create a new movie, add a circle and two buttons.


Controlling Frames with JavaScript 1

In the properties of the first frame of the circle. Turn off the timeline and set the 'Script ID' to BlueCircle.


Controlling Frames with JavaScript 2

Select the left button in the library and change it's 'On Click' event.



BlueCircle.X-=10;

Change the 'On Click' event of the right button.



BlueCircle.X+=10;

Press play to test the movie. Use the buttons to move the circle left and right.


Play Play

Controlling Frames with JavaScript 5

The same method can be used to change any of the frame properties such as 'Visible', 'Angle', 'Width' or Height.


Working with Inputs and Forms Holding Buttons