Example
The following example illustrates the correct use of
onClipEvent(load)
// symbol_mc is a movie clip symbol in the library.
// It is linked to the MovieClip class.
// The following function is triggered for each instance of symbol_mc
//
as it is instantiated and appears on the Timeline.
symbol_mc.onLoad = function() {
trace("The movie clip is loaded");
}
// dynamic_mc is a movie clip that is being loaded with MovieClip.loadMovie().
//
This code attempts to call a function when the clip is loaded,
//
but it will not work, because the loaded SWF is not a symbol
//
in the library associated with the MovieClip class.
function output()
{
trace("Will never be called.");
}
dynamic_mc.onLoad = output;
dynamic_mc.loadMovie("replacement.swf");
// The following function is invoked for any movie clip that
// appears on the Timeline, whether it is in the library or not.
// Therefore, this function is invoked when symbol_mc is instantiated
//
and also when replacement.swf is loaded.
OnClipEvent( load ) {
trace("The movie clip is loaded");
}
See also
onClipEvent()
MovieClip.onMouseDown
Availability
Flash Player 6.
Usage
my_mc.onMouseDown = function() {
// your statements here
}
Parameters
None.
Returns
Nothing.
Description
Event handler; invoked when the mouse button is pressed. You must define a function that
executes when the event handler is invoked.
524
Chapter 12: ActionScript Dictionary
.
MovieClip.onLoad()
and
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?