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

Scope

You’ve learned that to direct an ActionScript statement to affect a different Timeline, you need a target path that defines the scope. Without a target path, the ActionScript would affect its own Timeline. An ActionScript statement belongs, or is scoped, to a particular Timeline or a particular object where it resides. Everything you do in ActionScript has a scope, so you must be aware of it. You could be giving the correct ActionScript instructions, but if it isn’t scoped correctly, nothing—or, worse, unexpected—things could happen.

When you assign ActionScript to a frame of the _root Timeline, the statement is scoped to the _root Timeline. When you assign ActionScript to a frame of a movie-clip Timeline, the statement is scoped to that movie-clip Timeline. When you create ActionScript objects by using the constructor function new, that object is scoped to the Timeline where it was created. If you create a Date object (as you did in Chapter 3) on the main Timeline with the statement


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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