18 July 2010
The key to controlling visual elements with code is to understand the coordinate space within the timeline that the graphics are located in. Adobe Flash Player uses one or more nested timelines to create a movie (SWF file). Each timeline contains a registration point that marks the zero x coordinate and the zero y coordinate in the container. All measurements of movement and distance are judged in points (x, y) and their relation to the timeline's registration point.
This sample demonstrates how math functions can be used to calculate the distance, angle, and offset from a point in a timeline in relation to a center point. Click and drag the icon to see the results. You can use this type of functionality for game elements and various types of visual effects.