Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Flash

  • Print
  • + Share This
Like this article? We recommend

The Print Button

Before you get to the final printing function, go ahead and add the code that will enable the print button.

If you haven’t already done so, select the print button on the stage, and open Window>Properties>Properties to make sure that you have correctly named the button. You can, of course, name it anything you like, but for this tutorial I named it, imaginatively enough, print_btn.

If all is in order, return to the code layer, select the first frame, return to the Actions window in which almost all the code resides, and add the following code.

This code simply defines an event for the button. When it is released, it will call the PrintText function and send along the parameter mc2.text2.

print_btn.onRelease = function() {
   // give the function the name of the textarea to print

Now let’s move on to the function at the heart of all this: the PrintText() function.

  • + Share This
  • 🔖 Save To Your Account