Friday, January 12, 2007

Flash PnC tutorial - 3. Objects

You have button objects, movie clip objects and graphic objects. Buttons have a simpler set of behaviors than movie clips, which can span multiple frames. An example of a button is what you click to move from room a to room b. An example of a movie clip is a button that will not only take you from room a to b when you click on it, but has an arrow that wiggles in the room-a-to-b direction. A button can swap colors when you mouse over it, but it cannot (afaik) change size, move, or change colors subtly/gradually.

Graphic objects just don’t seem to be used all that much. Button objects are more functional, and movie clip objects are the most functional.

Button and movie clip objects can be given behaviors in two different ways.

The first way I’d call internal. I’m sure there’s an official term for it, but I call it internal reference. When you place the button on the frame, and select it, in the Actions (i.e. Actionscript) panel you’ll have a place to put code. You’re putting the code in the button itself, and the way you control its click action looks like
On (release) {
Do stuff

The second way is external. The code is placed in the frame that contains the button. (i.e. select the frame in the timeline, then look in the Actions panel). In order to reference the button and give it instructions, the button has to be named (done in the Properties panel). In this situation, your code would look like
Buttonname.onRelease = function () {
Do stuff

There are advantages and disadvantages to both. For a simple navigation button that gets you from point A to point B, I tend to use the internal form of coding. You don’t need to bother with naming the button. But with more complex instructions, the external form is better.

No comments: