flash (macromedia):
Hey everyone, I have a simple script that is on a movie clip called "murderer" - random I know. Anyway, this clip is on frame one but when I jump the play head to frame 5 it is still active...as In the loop of the event handler still seems to be taking effect even if it's not on that keyframe. What can I do to stop this loop going round? onClipEvent (enterFrame) { count = 1; function dupFunction() { _root.murderer.duplicateMovieClip("murderer_x"+count, count); _root["murderer_x"+count]._x = random(550); _root["murderer_x"+count]._y = random(400); _root["murderer_x"+count]._xscale = random(150); _root["murderer_x"+count]._yscale = random(150); _root["murderer_x"+count]._alpha = random(100); _root["murderer_x"+count]._rotation = random(360); count += 1; } setInterval(dupFunction, 20); } Any help is much appreciated. Thanks for your time!
Delete all that code. Click on the current frame in the Timeline panel. Open the Actions panel, and add this code: count = 0; this.onEnterFrame = function(){ var mclip = murderer.duplicateMovieClip("murderer_x"+count, count); mclip._x = random(550); mclip._y = random(400); mclip._xscale = random(150); mclip._yscale = random(150); mclip._alpha = random(100); mclip._rotation = random(360); count ++; } Then, click on Frame 5 and open the Actions Panel. Paste in: delete this.onEnterFrame;
Originally posted by: NSurveyor Delete all that code. Click on the current frame in the Timeline panel. Open the Actions panel, and add this code: count = 0; this.onEnterFrame = function(){ var mclip = murderer.duplicateMovieClip("murderer_x"+count, count); mclip._x = random(550); mclip._y = random(400); mclip._xscale = random(150); mclip._yscale = random(150); mclip._alpha = random(100); mclip._rotation = random(360); count ++; } Then, click on Frame 5 and open the Actions Panel. Paste in: delete this.onEnterFrame; You my friend are a God send. Thank you so much!
You've been tricked by the misleading name 'onEnterFrame' This event is not one that happens when the playhead enters a frame. actions that you put directly in the frame are those actions. onEnterFrame REALLY means 'at the actual frame rate' its a bit like a setInterval, only the rate is synchronised with the actual current frame rate. -- Jeckyl
Don't see what you're looking for? Try a search.
|