flash actionscript:
hello all, i'd really appreciate any help you can give me on this problem. i'm
not that great at flash...yet...but i'm trying to get better! i broke down my
problem in outline form. --kevin;) GOAL: -after a timeout period, a
'randomized' screen saver is called. when the mouse is moved, the screensaver
stops as does the timer function calling it. PROCESS: 1) the setInterval
calls the timer function 2) the timer function uses getTimer to calculate
3second intervals at which to run certain elements of the screensaver 3) the
screensaver uses duplicateMovie and Math.random to create a 'dynamic'
screensaver. PROBLEM: -i can't really get the timer function to stop calling
the screensaver using the onMouseMove clip event. It works, but once the mouse
stops moving, the timer function resumes calling the screensaver.
funk = 0;
//calls timedRelease after a long time
screenSaverInterval = setInterval(timedRelease(), 20000, funk);
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////
//when invoked, this function calls the screensaver to create another instance
of an animation in the flash at 3 second intervals
function timedRelease(funk) {
var timerObject = new Date();
var endTime = timerObject.getTime()+20000;
var delayMe = setInterval(function () {
var timerObject = new Date();
_root.quakePlot._visible = false;
var currentTime = timerObject.getTime();
if (currentTime>=endTime) {
screenSaverFunction(funk++);
} else {
// timedRelease(reportTime);
}
}, 3000);
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////
//creates randomly sized and placed instances of a movie clip.
function screenSaverFunction() {
funk = funk-(-1);
funky = this;
screenSaver._visible = true;
locales._visible = false;
var radiateColor, radiSize;
//duplicates clip for screensaver
funky.bullseye.duplicateMovieClip("radiate"+funk, funk*100);
screenSaver.swapDepths(funk);
//makes new variable for coding ease
//assigns location based on random x and y values
funky["radiate"+funk]._x = Math.floor(Math.random()*1920);
funky["radiate"+funk]._y = Math.floor(Math.random()*1190);
funky["radiate"+funk]._alpha = 100;
//random size: use same value so x and y equal
radiSize = (Math.floor(Math.random()*200)+20);
funky["radiate"+funk]._xscale = radiSize;
funky["radiate"+funk]._yscale = radiSize;
//random color
radiateColor = new Color(funky["radiate"+funk]);
radiateColor.setRGB(Math.floor(Math.random()*0xFFFFFF));
//tells bullseye movie to play
funky["radiate"+funk].gotoAndPlay(1);
radi = funky["radiate"+funk];
//stops screensaver
radi.onMouseMove = function() {
v = 1;
deleteRadis(v);
function deleteRadis(v) {
deleteThisNow = ("radiate"+v);
removeMovieClip(deleteThisNow);
screenSaver._visible = false;
locales._visible = true;
quakePlot._visible = true;
v++;
if (v<100) {
deleteRadis(v);
}
}
};
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////