19 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.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.