flash actionscript:
I think you are setting these as handlers for the root movieclip by
placing them at the root. onMouseDown gets executed whenever the mouse
is down, regardless of where.
Try looking up "prototype" in the ActionScript dictionary for how to
redefine functions of base classes (like buttons and movieClips)
D
[quoted text, click to view] ASlearner wrote:
> I'm trying to get all instances of a movieClip take an action when loaded. I
> figured the way to do that is to use the onLoad function in the clip's
> timeline. However, I can't get that to work. Puzzling, because the equivalent
> idea works for onMouseDown (as shown below.) Can anyone help me with this?
>
> /* Following code placed in clip's first frame. */
>
> // WORKS. All instances resport when the mouse button is pressed.
> onMouseDown = function() {
> trace ("Mouse down! ..." + this);
> }
>
> // does NOT work. Why?
> onLoad = function() {
> trace ("Loaded!" + this);
> }
I'm trying to get all instances of a movieClip take an action when loaded. I
figured the way to do that is to use the onLoad function in the clip's
timeline. However, I can't get that to work. Puzzling, because the equivalent
idea works for onMouseDown (as shown below.) Can anyone help me with this?
/* Following code placed in clip's first frame. */
// WORKS. All instances resport when the mouse button is pressed.
onMouseDown = function() {
trace ("Mouse down! ..." + this);
}
// does NOT work. Why?
onLoad = function() {
trace ("Loaded!" + this);
}