Selteco.com > FlashDesignerZONE.com > Tutorials > T1078

Earth Day Flash Animation.

Loading Flash movie...

Download source project earthday.zip

Click on the ground to plant more trees. You can plant trees in the spring only!

  1. Launch Alligator and choose "Blank document"
  2. Set movie size to 700 x 340 pixels
  3. Set background of the frame to blue and delay to Stop
  4. Create the master tree, draw a new sprite, name it "tree". You may copy it from the project or draw your own tree
  5. Create the ground, draw a rectangle, convert it to curve and bend the top edge
  6. To create the sun draw a circle and apply yellow radial gradient to it.
  7. To create clouds draw an ellipse, convert it to curve and reshape it, apply light blue gradient to it
  8. Convert the cloud to sprite and apply long frame time (for example 35 seconds). Apply vertical movement to the cloud. Duplicate the sprite few times and change delay time so clouds appear randomly.
  9. Put actionscript to Frame 1 of the main movie
    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)

  10. Apply onClick action to the ground element:
    
    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 trees

    if(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

Products | Purchase | Downloads | Support | Flash Tutorials | Contact
Copyright © 1999-2017 Selteco Software, Inc. www.selteco.com, ph: +1 810 377 5778