What are ActionScript 3.0 Functions? A function is a reusable block of code. ActionScript code executes in linear fashion but with the use of functions allows us to execute code when and how we want. For example you may want a certain part of code to execute when a mouse click occurs. Below we'll go through how to write a function that will change the alpha setting of an object on the stage when hover your mouse over that object that object. Lets go through the code below.