3. Add new frame, change \"Frame 1\" to \"Master Frame (1)\"
4. Go to \"Frame 1\", select \"Master Frame (1)\" as the background:"/>
Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Create Flying Hearts Effect
Your Ad Here

Create Flying Hearts Effect


Download source project t1059.zip (2 kb)

1. Launch Flash Designer and set movie dimensions 500 x 500 (or any desired).

2. Change frame delay to "Stop".

3. Add new frame, change "Frame 1" to "Master Frame (1)"

4. Go to "Frame 1", select "Master Frame (1)" as the background:

Create a heart

1. Go to "Frame 1"

2. Choose "Frame" > "Insert from Gallery" and select Heart

3. Fill it with radial gradient (center color orange, outer color red), resize it to 52x37 pixels

4. Convert it to sprite ("Edit" > "Convert to Sprite")

5. Rename it to "heart" and check "ActionScript Target" under "Item" > "Placement Properties"

6. Move the sprite outside visible area

image 1

Create a background

1. Go to "Master Frame (1)"

2. Choose "Frame" > "Insert from Gallery" and select Heart

3. Fill it with vertical gradient, top color light red, bottom color dark red

4. Duplicate, enlarge and position both hearts to create the background

image 2

Add ActionScript:

Go to "Frame 1", choose "Frame" > "ActionScript" and paste the code:

maxhearts = 100;

var hearts = new Array();

for(i=0;i<maxhearts;i++)
{
hearts[i] = heart.duplicateMovieClip("heart"+i,100+i);

// put it in random place
hearts[i]._x = Stage.width*Math.random();
hearts[i]._y = Stage.height*Math.random();
hearts[i]._xscale = 40+Math.random()*60;
hearts[i]._yscale = hearts[i]._xscale;

hearts[i].yspeed = Math.random()*4+ 1;
hearts[i].increment = -0.025+Math.random()*0.05;
hearts[i].onEnterFrame = function() {
this.radians = this.increment + this.radians;
this._y = this._y - this.yspeed;
this._x = Math.sin(this.radians) + this._x;
if (this._y<-20) {
this._y = Stage.height;
this._x = 0-10+Math.random()*Stage.width;
}
}
}

Hit F9 for preview.

INFO: to place an object in front of hearts, select it, choose "Item" > "Placement Properties" and change the layer to higher value, for example "Layer 3":

image 3



Author's URL: Selteco.com
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Internet & computing Flash is a vector-based moving graphics format created by Macromedia for the publication of animations on the World Wide Web. More Flash & Swish: Most Popular Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

Add comments to "Create Flying Hearts Effect"

Only registered users can write comment

Reader's comments