Tab between the two instances, and information displays in the Output panel.
See also
onSetFocus (MovieClip.onSetFocus handler)
onLoad (MovieClip.onLoad handler)
onLoad = function() {}
Invoked when the movie clip is instantiated and appears in the timeline. You must define a
function that executes when the event handler is invoked. You can define the function on the
timeline or in a class file that extends the MovieClip class or is linked to a symbol in the
library.
You use this handler only with movie clips for which you have a symbol in the library that is
associated with a class. If you want an event handler to be invoked when a specific movie clip
loads, you must use
onClipEvent(load)
handlerl; for example, when you use
dynamically. Unlike
MovieClip.onLoad
loads.
Availability: ActionScript 1.0; Flash Player 6
Example
This example shows you how to use the
definition that extends the MovieClip class. First, create a class file named Oval.as and define
a class method named
path, as in the following example:
// contents of Oval.as
class Oval extends MovieClip{
public function onLoad () {
trace ("onLoad called");
}
}
Second, create a movie clip symbol in your library and name it Oval. Context-click (usually
right-click) on the symbol in the Library panel and select Linkage... from the pop-up menu.
Click the Export for ActionScript option and enter
2.0 Class fields. Leave the "Export in First Frame" option selected, and click OK.
Third, go to the first frame of your file and enter the following code in the Actions Panel:
var myOval:Oval = Oval(attachMovie("Oval","Oval_1",1));
Finally, do a test movie, and you should see the output text "onLoad called".
906
ActionScript classes
or the MovieClipLoader class instead of this
MovieClip.loadMovie()
, the other handlers are invoked when any movie clip
onLoad
. Then ensure that the class file is placed in the proper class
onLoad()
to load a SWF file
event handler in an ActionScript 2.0 class
in the Identifier and ActionScript
Oval
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?