View Full Version : Flash Flame Won't Stop
berzerk
02-06-2006, 03:17 PM
We're trying to incorporate this animation within a flash movie, but are having a hard time at making the flame stop at frame 60. How would this be done? I've tried breaks and stops but the flame continues for the entire movie.
Thanks.
http://www.sitepoint.com/article/flash-script-fire-effect
it don't ever get to frame 60 as you keep telling it to play frame 2, so its just looping
var i:Number = 0;
var frames:Number = 60;
fl._visible;
pos = fl._x;
onEnterFrame = function()
{
if(frames < 60)
{
if(i < 35)
{
var dup:MovieClip = duplicateMovieClip ("fl" + i, i);
dup._alpha = i * 8;
dup._x = random(3) + pos);
i++;
}
frames++;
}
else
{
delete this.onEnterFrame;
}
berzerk
02-06-2006, 10:23 PM
Appreciate it!! :)
But, the flame seems to just eminate little 'puffs' now, almsot like it's only allowing 1 flame particle to be on screen at a time. Anyway to allow more so it looks like a constant flame?
Thanks again!
berzerk
02-06-2006, 10:34 PM
Ok here's the problem now.
The line:
var dup:MovieClip = duplicateMovieClip ("fl" + i, i);
Makes it so it just 'puffs', but stops when it should. But I get an error that there should be 3 parameters.
If I change that to:
var dup:MovieClip = duplicateMovieClip ("/fl", "fl" + i, i);
The flame is perfect but will continue on to the other part of the clip and won't stop.
I'm stumped..
my bad i didn't test it
this works. do the same as in the tutorial although only have one frame on your main timeline. but this script on the timelinevar i:Number = 0;
var frame:Number = 0;
//change this number to change the amount of frames the flame lasts for
var maxFrames:Number = 60;
fl._visible = false;
var pos:Number = fl._x;
var kill:Boolean = false;
function buildFlame()
{
if(frame < maxFrames)
{
if(i < 35)
{
var dup:MovieClip = fl.duplicateMovieClip ("fl" + i, i);
dup._alpha = i * 8;
dup._x = random(15) + pos;
i++;
}
frame++;
}
else
{
delete onEnterFrame;
kill = true;
}
}
onEnterFrame = buildFlame;then add this to the last frame of you timeline animated flame particlesif(_parent.kill == true) this.removeMovieClip();
berzerk
02-09-2006, 08:13 PM
Didn't work either and 3 actionscript errors. :(
I tried removing where you have false set, and it went back to the 'puff...puff...puff" thing I mentioned earlier.
works fine for me.
you need to make sure your publishing AS 2.0, and that the code is on the timeline not the clip.
maybe you could enlighten us with the errors you get?
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.