MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 338

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

You can attach
onClipEvent()
on the Stage during authoring. You cannot attach
instances that are created at runtime (using the
attach event handlers to objects created at runtime, use event handler methods or event
listeners. (See
"Using event handler methods" on page 330
on page
332.)
Attaching
onClipEvent()
should put your code in frame scripts or in a class file, as demonstrated throughout this
manual. For more information, see
"Attaching code to objects" on page
For more information on button and movie clip event handlers, see the following topics:
"Using on and onClipEvent with event handler methods" on page 338
"Specifying events for on or onClipEvent methods" on page 340
"Attaching or assigning multiple handlers to one object" on page 341
Using on and onClipEvent with event handler
methods
You can, in some cases, use different techniques to handle events without conflict. Using the
and
on()
onClipEvent()
you define.
For example, suppose you have a button in a SWF file; the button can have an
handler that tells the SWF file to play, and the same button can have an
for which you define a function that tells an object on the Stage to rotate. When you click the
button, the SWF file plays and the object rotates. Depending on when and what kinds of
events you want to invoke, you can use the
handler methods, or both techniques of event handling.
However, the scope of variables and objects in
than in event handler and event listeners. See
You can also use
on()
more information, see
information on specifying events for
or onClipEvent methods" on page
338
Handling Events
and
only to movie clip instances that have been placed
on()
and
handlers is not a recommended practice. Instead, you
on()
"Using event handler methods" on page 330
746.
methods doesn't conflict with using event handler methods that
with movie clips to create movie clips that receive button events. For
"Creating movie clips with button states" on page
and
on()
340.
onClipEvent()
attachMovie()
and
"Using event listeners"
and
on()
onClipEvent() methods
and
on()
onClipEvent()
"Event handler scope" on page
, see
onClipEvent()
or
to movie clip
on()
method, for example). To
on(press)
method,
onPress()
, event
handlers is different
343.
342. For
"Specifying events for on
and

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents