Lets say I have a code like
These short of codes are generally go inside a button instance or a movieclip instance. Suppose I have a button on stage, whose name is myBtn.If I have to write a code like above then I will select the button, open the actions pannel and write the above code in it.But there is another method of writing the same code too.Which is to write the code in a frame.Now if we take the previous example, then on my stage I have only one button instance at the first frame of my movie.So I will just create another layer, for the sake of clarity.Then I will name the layer as "Actions".Now put a blank keyframe in the Actions layer.Select the Frame and open actions pannel.Now the code I will write for myBtn will look like below code;
Just look at the code.Its doing the same thing in both the cases, but the place and the style of writing has changed.So if you plan to keep all your code in a frame, which is advisable then follow this basic instruction.
Happy flashing ;)