• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. Manipulating Information > Building Reusable Scripts

Building Reusable Scripts

When you need to perform the same kind of manipulation of information multiple times, you can save time and reduce code clutter by building your own functions. You used functions in previous chapters, mostly as event handlers. When you assign an anonymous function to an event, for example, that function is triggered whenever the event happens. But whether they are anonymous or named, functions have the same job: They group related statements to perform a task that you can invoke from anywhere, at any time. You decide how to mix and match ActionScript statements as needed.

To create a function, use the function command in the Actions toolbox (Actions > User-Defined Functions > function), and give your function a name. Your statement could look something like this:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint