change speed of MC w/ setInterval
OK, I am trying to make a driving game. The car just moves side to side, I want to beable to control the speed of the track- ie acceleration, on collision with the side of the track speed reduces, etc. I am just trying to get basic control over the speed. this is what I have so far. its all in the first actions frame:
carSpeed = 2000;
track.onRelease = function(){
carSpeed = carSpeed - 500;
}
onEnterFrame = function() {//for (carSpeed > 200) {
trackFrames = function () {
track.nextFrame();
updateAfterEvent();
};
speed = setInterval(trackFrames, carSpeed);
at this point I'm just trying to gain control before I start adding collision and whatnot. The problem with this is that it appears to accelerate on it's own. When I click, it acclerates more quickly.
I have also tried attaching keyPress<"Up"> to the track MC, but it doesn't seem to work.
Any suggestions? Should I attach to the actions to the track MC?
Another Problem If you may...
I'm making a presentation cd that has a CLIP were inside are frames with stop() action
and a LoadMovie command in each frame for my external SLIDESHOW SWF files
Here's the dilema :
In my External SWF file I have a stop in each frame and a code:
----------------------------------------------
DisplayTime = 5
Countdown = function (message)(displayTime --; if (displayTime == 0){clearinterval(timer);nextFrame();}};
timer=setInterval(countdown,1000);
}
At the end of the slideshow I have one empty slideshow with GotoAndPlay(1)
----------------------------------------------
I have about 30 buttons for each Slideshow
In each frame I also have UnloadMovie.CLIPS.NSlideshow.swf()
It loads the clips but on each new click of another button in Scene
The slideshow becomes faster and faster ...- it pisses me of please
HELP!