onClipEvent(initialize)
For all those who still like to program the onClipEvent way Ted Patrick has discovered an undocumented Flash MX feature: there exist an onClipEvent(initialize) which gets fired before the onClipEvent(load) function. The question remains what this might be good for, currently the only use could be Peter Elst's proposal to dynamically define an onload handler, something like this:
onClipEvent(initialize) {
this.onLoad = function() {
trace("onLoad function defined in initialize event");
}
}
Posted at March 20, 2003 06:19 PM | Further reading
Intialize allows load (well initialize) events on child movieclips to be fired before a parent load event. Normally, load events begin with parents first, followed by the load events of each consecutive child movieclip followed by each of their child movieclip(s) and so on. Using intialize on child movieclips allows you to run script prior to any parent's load event beating them to the punch since all child movieclips' initialize events happen before any load event. This allows interior setting of functions or variables or whathaveyou which can then be accessed by a parent's load event.
Just a heads up since i came across your website by accident... maybe offering simple clarity
onClipEvent(initialize) {
....
}
... happens before the script that is on the same frame the movieclip/component is on.
example:
onClipEvent(initialize) {
trace("initialize script: "+this);
}
and on the same frame the component/movieclip resides in, simply put:
trace("frame script: "+this);
the end result in your output window being:
initialize script: _level0.instance0
frame script: _level0
enjoy.