• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1658
  • Last Modified:

Flash Sparkle Effect

I'm trying to build a sparkle effect in Flash 8. I need something similar to the sparkles in the header at this page: http://dailyholidays.net/month.php?month=2. I will have some objects falling vertically, and I need the sparkles to come off the objects just like http://dailyholidays.net/month.php?month=2.

Is there any freeware to do this? If not, are there any simple tutorials that I can follow quickly? Thanks guys.
0
isaacr25
Asked:
isaacr25
2 Solutions
 
TanLiHaoCommented:
First draw a star. Then convert it to a movie clip.  In the library, right click the properties of the movie clip of the star and export for actionscript. Also export for frame 1. Make sure the identifier is called star.

Create another shape, the shape you want the stars to follow, for example , you draw a circle and convert it to a movie clip. Give it an instance name of obj. Tween the circle.

Then add this code in frame 1

var maxNegativePosition:Number = 20;
var maxPositivePosition:Number = 80;
var scaleNum:Number = 5;
var scaleRotation:Number = 4;

var star:MovieClip;

function moveStar(starInstance:MovieClip) {
    starInstance._xscale -= scaleNum;
    starInstance._yscale -= scaleNum;
    starInstance._rotation += scaleRotation;

    if (starInstance._xscale <= 1) {
        starInstance.removeMovieClip();
    }
}

function createStars():Void {
    star = attachMovie("star", "star"+this.getNextHighestDepth(), this.getNextHighestDepth());
    star._x = obj._x - Math.floor(Math.random() * maxNegativePosition);
    star._y = obj._y - Math.floor(Math.random() * maxNegativePosition);
    star.onEnterFrame = function() {
        moveStar(this);
    };


    star = attachMovie("star", "star"+this.getNextHighestDepth(), this.getNextHighestDepth());
    star._x = obj._x + Math.floor(Math.random() * maxPositivePosition);
    star._y = obj._y + Math.floor(Math.random() * maxPositivePosition);
    star.onEnterFrame = function() {
        moveStar(this);        
    };
    numInstances++;
}

onEnterFrame = function() {
    createStars();
};

Stars will then be created at runtime and follow your circle or whatever object you created.
0
 
quizengineCommented:
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now