Sale icon animation

Date: 14.1.2010, 13:45    Total views: 7561

In this thoroughly explained, detailed flash lesson, I will show you how to create sale icon animation using the Action Script code. You can use this animation as banner for some web shop site or when you like to present something. Let's start!







Example:



Step 1

First, download the sale icon that we will use for this lesson.

Step 2

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the width of your document to 400 pixels and the height to 300 pixels. Select #CCCCCC color as background color. Set your Flash movie's frame rate to 34 and click ok.



Step 3

Call the current layer sale icon. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 4

Choose now File > Import > Import to stage (Ctrl+R) and import the icon that you just downloaded in step 1 into a flash stage.

Step 5

While the sale icon is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.



Step 6

While the new made movie clip is still selected, hit delete key on the keyboard to delete it from the flash stage.

Step 7

Go now to to flash library (Ctrl+L), right click on the SaleIcon_mc and choose Linkage.

Step 8

After that, make the adjustments as follows:



Step 9

Select the first frame of layer sale icon and go to the AS panel (F9). Then, and enter this code inside the actions panel:

var icons = 14;
var maxSpeed = 14;
var minSpeed = 7

for (var i = 0; i var icon = this.attachMovie("icon", "icon"+i, i);
 icon._x = random(Stage.width);
 icon._y = random(Stage.height); 
 var size = random(2)+0.6*(random(5));
 icon._width = 90;
 icon._height = 90;
}

this.onEnterFrame = function() {
 for (var j = 0; j  var s = this["icon"+j];
  if (s._y>0) {
   s._y -= random(maxSpeed-minSpeed)+minSpeed;
  } else {
   s._y = Stage.height;
  }
 }
};

We're done!

Test your movie and enjoy!

Download source file (.fla)

  Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!
Share
ShareSidebar