all groups > flash (macromedia) > december 2005 >
You're in the

flash (macromedia)

group:

onClipEvent(enterFrame) PROBLEM



onClipEvent(enterFrame) PROBLEM Kapitaine
12/1/2005 10:39:45 PM
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!
Re: onClipEvent(enterFrame) PROBLEM NSurveyor
12/1/2005 11:05:37 PM
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;
Re: onClipEvent(enterFrame) PROBLEM Kapitaine
12/1/2005 11:17:56 PM
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!
Re: onClipEvent(enterFrame) PROBLEM NSurveyor
12/1/2005 11:26:34 PM
Re: onClipEvent(enterFrame) PROBLEM Jeckyl
12/2/2005 12:00:00 AM
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

AddThis Social Bookmark Button