I have a code to make confetti in my first scene and I only need it to happen on the first scene but it's happening on all of the scenes. If I put a stop()
; code at the end of Scene 1 on the keyframe
for the code layer, it stops the entire movie, not the code. I've also tried removeMovieClip();
on the frame with the movie clip code and that didn't work.
I have one layer with the movie clip, and the movie clip has this code on it:
onClipEvent (load) {
function reset() {
//generate the random color
R = random(256);
G = random(256);
B = random(256);
colorHexString = R.toString(16)+G.toString(16)+B.toString(16);
colorHex = parseInt(colorHexString, 16);
hairColor = new Color(this);
hairColor.setRGB(colorHex);
//generates random movemtn onscreen
xSpeed = random(3)+1;
ySpeed = (Math.random()+1)*random(5)+1;
if (ySpeed == 1) {
ySpeed = (Math.random()+1)*random(5)+1;
}
direction = random(2)+1;
//randomly places confetti at the top of the screen
position = random(863)+1;
_x = position;
_y = 0;
}
reset();
}
onClipEvent (enterFrame) {
//makes the confetti fall
_y += ySpeed;
directionChange = random(10)+1;
if (directionChange == 1) {
direction = random(2)+1;
xSpeed = random(3)+1;
}
if (direction == 1) {
_x += xSpeed;
}
if (direction == 2) {
_x -= xSpeed;
}
if (_y>400) {
reset();
}
}
Then I have a layer right above that called control that has this code in the first keyframe:
numConfetti = 100;
for (i=2; i<=numConfetti; i++) {
confetti1.duplicateMovieClip("confetti"+i, i+100);
}
This code was one I got online for confett
effect, so I'm not completely up to par with knowing how to fix it, but I know the basics. Can you please tell me how I can get the action to stop at the end of scene 1, and not continue to run as the Flash movie progresses to the next scene?
thank you so much! Jenn