Back to Entry Page

Notes on Franklin and Patton
Chapters 11 & 12

Chapter 11

Three basic concepts for Flash interactivity: event, action, and target.

Note the on(releaseOutside) event: not available in JavaScript or in most other languages I've seen. Likewise on(dragOver) and on(dragOut).

"Mouse events assigned to one instance of a button have no effect on other instances of the button..."

Note that you may have to activate Control>Test Movie to see button actions at work. Don't panic immediately if an action fails to run.

Keyboard events are case-sensitive.

An odd inconsistency in syntax. For buttons, you write on(release), but for movie clips i'ts onClipEvent(mouseUp). Somebody didn't get the story straight, but you'll have to live with it.

Is there a movie clip equivalent of rollover?

Note that Movie Clip events include many not availble to buttons, for instance onClipEvent(mouseMove). If you think about it, this makes sense: you're not intended to be dragging things around inside a button, but a movie clip may occupy a large part of the screen.

"Tell Target" versus "with"--Emily Carr usefully informs us that the former construction will be eliminated in the next release of Flash. Since the "with" strategy works just as well (see p. 287), don't bother using "Tell Target." Even better, consider using the dot notation style (bottom of 287), which is the most parallel with JavaScript and modern programming languages.

You can communicate among Flash movies in different Flash windows via JavaScript.

getURL() is most often used to call in a Web page, but can also be used to send information to a Common Gateway Interface Script (CGI). By using the preface "javascript:" you can also use getURL() to communicate with JavaScript on the hosting page. This is essentially the same thing as using the FSCommand action.

Chapter 12

Okay, this chapter is a big gulp... read it through once and digest what you can. We'll be covering most of its material in smaller doses during the rest of the course.

For those of you who have worked with JavaScript before, this chapter will seem very homey. With a few small exceptions, ActionScript simply is JavaScript adapted for use within Flash.

Visual Design vs. Programming: the difference in most cases comes down to variability. Without variables and procedures (program instructions), your content can only unfold in one way.

Unlike in some genuine programming languages (for instance, C++), ActionScript does not require formal variable declarations. Variables are declared (i.e., assigned a type) as they are used.

Variables, and as we'll see, functions as well, can be nested within movies and movie clips. This brings us to "dot syntax," the conventional way of referring to items that are attached to other items (or objects) within a complex information system.

Variables associated with dynamic text elements are defined in the dialog that creates the element, not in the script.

As in JavaScript, the + operator indicates mathematical addition when it is used between two numbers, but textual concatenation (gluing-together) when it is used between two text strings. If you use + between a number and a string, the number will be converted to a string, which will be concatenated with the other string.

The for loop and other control statements in ActionScript are syntactically indentical to their JavaScript (or Java) counterparts.

ActionScript includes continue and break, two very useful statements for controlling program flow in loops (early versions of JavaScript lacked these features).

You may define your own functions in ActionScript, just as you may in JavaScript. Again, the syntax is the same in both.

The main movie is referred to in dot syntax as _root.

There are three ways to direct an action to a particular target:
  • Tell Target: this syntax is apparently due for elimination in future versions of Flash;

  • Dot syntax: As in "_root.clip99.alpha = 35"; this syntax is fine if you are referring to only one target at a time;

  • With(): This statement allows you to specify a target for a range of statements that follow the "with" clause, contained in curly braces; this is the syntax to use if you want multiple actions applied to a single target.

Like all object-oriented programming schemes, ActionScript contains at least a minimal notion of inheritance, whereby children of parent objects (movies, movie clips) take on properties assigned to the parents. For instance, if you make the root movie 50% transparent, all movies contained within its timeline will also acquire that level of transparency.

The _url property seems to exist mainly to protect intellectual property. You can use it to prevent bits of your Flash movie from being expropriated and used in someone else's movie.

Like JavaScript, ActionScript has various specialized objects for movie clips, dates, mathematical concepts, arrays, sound, etc.

Smart Clips are a bit like Java classes (though not quite so sophisticated)--they allow you essentially to create new systems of objects and procedures, whose functioning is streamlined for later users.

Since printing has always been problematic in Flash, ActionScript now includes specialized print objects which, among other things, can be used to incorporate hidden content suitable for printing.


University of Baltimore Logo

Copyright © 2002 School of Information Arts and Technologies