PDA

View Full Version : onClipEvent(Load) Question



zain
June 12th, 2002, 10:35 AM
I have a movie with one layer and two keyframes.
On the first keyframe is a movieclip (instance name 'MC')
with the following actionscript

onClipEvent (load) {
&nbsp &nbsp &nbsp &nbsp xyz = 5;
trace(xyz);
}

The second keyframe is empty but holds the actionscript:

_root.MC.xyz = 10;
trace(_root.MC.xyz);


my question is when i test the movie ... why does the trace action constantly ouput 5s ?? shouldnt it output 5 once and then costantly output 10s? because isnt a movieclip only loaded once??

bit confused here...any help appreciated..thanks

Iammontoya
June 12th, 2002, 01:47 PM
you have two frames on the main timeline, so it will loop and continue referencing frame 1

zain
June 12th, 2002, 04:49 PM
yes but when the playhead goes over frame 2, why doesnt it change the variable to 10?

and another thing is- isnt a movie clip only loaded once? i.e not everytime the playhead moves over it?

cheers

suprabeener
June 13th, 2002, 01:36 AM
because the second frame is empty (the movie doesn't exist), when the playhead moves back to one, the movie is loaded, and the load event fires again.

try putting the frame actions on one level in frame 2, and the clip on another level which spans both frames. then you'll get the result you're expecting.