Download source project earthday.zip
Click on the ground to plant more trees. You can plant trees in the spring only!
var trees = new Array();
maxtrees = 0;
function grow_trees()
{
for(i=0;i<maxtrees;i++)
{
trees[i]._xscale = trees[i]._xscale +1;
trees[i]._yscale = trees[i]._yscale +1;
}
}
setInterval(grow_trees,1000);
setInterval(grow_trees,1000); runs grow_trees() function every 1000 miliseconds (1 second)
if(tree._currentframe<40)
{
trees[maxtrees] = tree.duplicateMovieClip("tree"+maxtrees,100+maxtrees+_root._ymouse);
trees[maxtrees]._x = _root._xmouse;
trees[maxtrees]._y = _root._ymouse;
maxtrees = maxtrees + 1;
}
maxtrees is the total number of treesif(tree._currentframe<40) lets the user to plant trees only during spring
tree.duplicateMovieClip("tree"+maxtrees,100+maxtrees+_root._ymouse); this creates a new tree and positions the new tree in front of other trees, higher _ymouse converts to higher so called Flash depth
_root._xmouse, _root._ymouse this is the current mouse position