![macromedia mx 2004 macromedia mx 2004](https://images-na.ssl-images-amazon.com/images/I/51wHxJawoKL._SX380_BO1,204,203,200_.jpg)
Actions triggered by the enterFrame event are processed before any other actions that appear in a particular frame.īecause these events are specific to movie clips, the event handlers must be attached to specific movie clip instances. The onClipEvent(enterFrame) event happens every time a movie clip enters a frame in its timeline. The onClipEvent(load) event happens once, when the movie clip is loaded into the movie. You can see a menu of onClipEvent events by typing the handler into the Script pane or selecting onClipEvent from the Movie Clip Control folder: The onClipEvent handler detects movie clip events that are either user-initiated, like mouseDown, mouseUp and keyDown, or that are triggered when the movie clip loads ( load) or enters a frame ( enterFrame). Some event handlers are, or can be, system-initiated or time-based. The User Interface components are actually compiled movie clips, so don’t confuse the Button component with a button symbol. When you add an event handler to the Script pane, Flash opens a menu that displays the available events:įlash MX 2004 includes some new events for example, the click event has been added for use with Flash’s User Interface components. Thanks to Flash’s Intellisense, it isn’t necessary to remember all the possible events.
![macromedia mx 2004 macromedia mx 2004](https://www.researchgate.net/profile/E-Gomez/publication/275065139/figure/fig1/AS:614096458235905@1523423413843/MACROMEDIA-DIRECTOR-2004-software-structure.png)
#MACROMEDIA MX 2004 CODE#
One way around this problem is to create an invisible button to attach the code to. Below, the on event handler is used to trigger an action when the user either clicks the button or presses Enter:Īlthough a keyPress event can occur at any time in the movie, it still must be attached to a specific button instance. You can combine events in one event handler by including both events in the parentheses, separated by a comma. KeyPress events are also case-sensitive, and multiple key combinations are not supported.īutton, movie clip, and keyboard ( keyPress) events are attached to button and movie clip instances on the stage, since it’s the user’s interaction with these objects that trigger the events. Other keys are only enclosed in quotation marks. Similarly, the following code triggers a gotoAndPlay action when the user presses Enter on the keyboard:Įnter, Esc (Escape), and arrow keys ( Left, Right, etc.) must be enclosed in the less-than () symbols. This code lets the user click and drag a movie clip. For example, the code in the screenshot above, which is attached to a movie clip instance named bad_driving_mc, causes the startDrag action to occur when the user presses the mouse button ( on (press)) and the stopDrag action to occur when the user releases the mouse button ( on (release)).
![macromedia mx 2004 macromedia mx 2004](http://designstacks.net/content_images/MacromediaProducts/MacromediaFlash/DrawingandAnimating.gif)
These events-which include click, press, release, rollover and keyPress-trigger user-initiated actions. The on event handler is used to detect mouse, keyboard and movie clip events. When adding event handlers, you add the event in parentheses and the resulting behaviors, or actions, between curly braces, as shown below: For example, if a button is being clicked to produce the action, the event handler must be added to the button, and not to a frame on the main timeline. You add the code for event handlers to whatever object is producing the action.
![macromedia mx 2004 macromedia mx 2004](http://assets.oldversion.s3.amazonaws.com/images/macromedia-dreamweaver-mx-2004-screen-46.jpg)
But most actions need to be placed in event handlers, so Flash knows when to execute them. Because the timeline automatically moves from frame to frame, you don’t need to explicitly state the event causing the stop action-as soon as Flash encounters the action in the frame, it will execute the action. When you added the stop action to the first and last keyframes of the animation in the last section, those actions, or behaviors, were caused by the timeline entering those frames. It can be caused by a user’s interaction with a button (such as clicking it or rolling over it), a user’s keystroke (when the user presses a certain key on the keyboard), or a system event, like the timeline entering a frame. In simple terms, you told Flash that the cause-the event-was the release of the mouse button ( on(release)) and the resulting behavior was play.Īny number of things in Flash can cause a behavior. In the last section, you added an event handler to a button that caused the animation to play.