
104
Use motion paths
Last updated 6/15/2014
• You can add comments to remind you or others of what you are accomplishing with different parts of the script. To
add a comment for a single line, start it with two slashes (//). To type a multiline comment, start it with /* and end
it with */. Comments are ignored by JavaScript and won’t affect your code at all.
• Thesemicolon at the end of the line tells JavaScript that it has reached the end of a complete statement and the end
of a line of code. A semicolon is like a period in a sentence.
That’s a lot of information packed into a single line of code! But getting comfortable with the syntax is your first step in
g
et
ting out from behind the steering wheel and looking under the hood of your car.
Events and actions
So far, you’ve seen how Edge Animate uses triggers to automatically execute JavaScript when the playhead reaches a
certain point on the Timeline. You added a trigger at the end of the animation to create a loop. The other two ways with
which Edge Animate adds JavaScript is with events and actions.
Events are occurrences that happen in Edge Animate that it can detect and respond to. When an event is detected, you
p
ro
vide actions as a response.
It’s useful to think of interactions in terms of events and actions. When you click on a menu button (event), more
opt
ions may expand (actions). When you roll over a button (event), a triangular play icon may appear on it (actions).
In the next section, you’ll add thumbnail images to the Stage. When the user clicks on each thumbnail (event), the
playhead will move to a new position on the Timeline (actions) to show a particular image from the travel slideshow.
Creating the buttons
A button is a basic visual indicator of what the user can interact with. The user usually clicks a button, but many other
types of interactions are possible. For example, rollovers, double-clicks, and rollouts are all possible. Edge Animate also
provides events unique to mobile devices, such as touches.
You’ll start with the simplest, and most common event, which is the single-click.
Adding the thumbnails
Small, cropped versions of the larger Burma images are provided for you in the images folder.
1 In the Library panel, expand the images folder within the Assets folder.
2 Drag the file called button1_gray.jpg from the Library panel to the Stage.
A grayscale thumbnail of fisherman appears on the St
age, Timeline, and Elements panel.
3 Position the thumbnail so that its top-left corner is at the top-left corner of the Stage. The coordinates should be at
X=0, Y=0.
Kommentare zu diesen Handbüchern