Flash Lessons

FLASH TUTORIALS AND LESSONS

Wednesday, March 18, 2009

Custom FLASH mouse icon and speed

In this tutorial you will find how to create your custom FLASH mouse icon and how to change the speed of cursor

1. Set the movie frame rate to 25 - I use it, because whith frame rate the animation is smooth.

Modify -> Document -> Frame rate: 25 -> OK

2. Create new movie clip which will be the cursor and draw your custom icon for the cursor. Name it "cursor_mc" (without the quotation marks)(the abbreviation "mc" came from "Movie Clip")

3. In the Properties panel set the instance name to "cursor_mc"

4. In the frame 1 paste the following code:

Mouse.hide();
var speed:Number = new Number(20);
cursor_mc.onEnterFrame = function() {
this._x += this._xmouse/(20/speed);
this._y += this._ymouse/(20/speed);
};


5. Test your project.

Bookmark and Share


Tuesday, March 17, 2009

Create falling snow on flash

This tutorial help you to create a falling snow effect in Flash.

Lets start.

1. Create a new document with size 500x500. The frame rate must be 20 or 25 for smooth animation. For this tutorial I choose 25. The color of background must be black (or some other, but dark color).




2. Now you have to create a new symbol. There is 2 ways for that - press F8 or go to Insert->New Symbol




* Remember, that in the Type menu must be selected "Movie Clip"

3. Now you must to draw one single snowflake. In the symbol you created, create the snowflake the way you like. For this tutorial I choose circle with gradient.




4. Press on the Scene 1 button to go to the main scene




5. Now go to Window->Library or press Ctrl + L. Find your movie clip you just created and click on it with the right mouse button. Choose Linkage and be sure that the Linkage properties of the movie clip are as the image bellow:




Ok - you will say - We create just a single snowflake, but we whant a snowfall. Do not worry - here will help us the Actionscript code.

6. Click on Frame 1 in the timeline




7. Press F9 or go to Window->Actions.

8. Copy the code bellow and paste it to the just opened window called Actions

width = 500;
height = 500;
total = 200;
for (var t = 0; t != total; t++) {
var mc = _root.attachMovie("snowflake", "snowflake"+t, _root.getNextHighestDepth());
mc._x = (Math.random()*(width+20))-10;
mc._y = (Math.random()*(height+20))-10;
mc.yspeed = (Math.random()*1.75)+0.25;
mc.speed = (Math.random()*3)+2;
mc._xscale = mc._yscale=(mc.speed+mc.yspeed)*10;
mc.onEnterFrame = function() {
var angle = Math.atan2(_root._xmouse-(width/2), _root._ymouse)+1.5707963267949;
this._y += Math.sin(angle)*this.speed+this.yspeed;
this._x += Math.cos(angle)*this.speed;
if (this._x>width+10) {
this._x = -10;
} else if (this._x<0-10) {
this._x = width+10;
}
if (this._y>height+10) {
this._y = -10;
} else if (this._y<0-10) {
this._y = height+10;
}
};
}


9. Now press Ctrl + Enter to see your creation

You can play with the actionscript to change the number of flakes, the speed etc. Be carefull with corrections

Keep Flashing :)

Bookmark and Share


Flash lessons and tutorials

Flash lessons and tutorials

Bookmark and Share