Definition: In Flash, a function defines a block of ActionScripted code. In specific, the term "function" encompasses a block of code that performs a certain task. Functions can be thought of as miniature programs within a program; each program has its own set purpose, and when the program is run it follows the instructions in the code until that purpose is accomplished, then ends.
Simply stringing lines of code together doesn't make it a function; a function must be defined by name, and any actions or parameters within the function's constraints are a part of that function.
Functions are used to enclose the code for a specific action in a Flash movie, so it can later be called by name whenever it's needed.

