Flash Tutorials
& Resources
Dreamweaver
Tutorials
Fireworks &
Illustrator Tutorials
Photoshop
Tutorials
Web Design
Tutorials & Resources
CSS
Tutorials
CorelDraw
Tutorials
You are here : : Home > Free Resources > Flash Tutorials & Resources > Random Movement   

Flash Tutorials

Basics

Animation & Effects

Actionscript

Creating a Website

Miscellaneous

Flash Articles

Free Flash Resources

Other Flash Resources

Random Movement in Flash using Simple Actionscript

Random Movement in Flash

Learn how to create random movement in Flash using movie clips and simple actionscript.
Please note:
1. You need to have Flash Player 7.0 installed to view the Flash animation.
2. Flash MX 2004 or higher must be installed on your system to open the .fla file.

Download the .fla file

STEPS TO FOLLOW

  1. Import the Background Image
    Open a new file. Go to File >New. Select Flash Document. Click OK. Go to Modify > Document to give a file size of 237px by 268px. This is the same size as the Bitmap picture we have. Select the Bitmap picture which you want to use as the background and bring it to the Flash Library by clicking on Select File > Import to Library from the Menu Bar. Go to Window > Library, You can see the picture in the Library panel. Drag the picture to the Stage. This will be in your first layer, name it background.

  2. Create the dot movie clip
    Add a new layer and name it dot . Draw a red dot with the oval tool, press shift so that the circle comes out round. Make the size 2px by 2px. Select the borders and delete them. Click on the dot. Go to Modify>Convert to Symbol from the Menu Bar. A dialog Box named Create New Symbol will appear. Give the name as dot_mc. Select Movie Clip. Click on OK.

  3. Create the heart movie clip
    Add a new layer and name it heart. Draw or import a heart. Make the size as 10px by 10px Click on the heart. Go to Modify>Convert to Symbol from the Menu Bar. A dialog Box named Create New Symbol will appear. Give the name as heart_mc. Select Movie Clip. Click on OK.

  4. Add simple Actionscript to the movie clips
    Select the dot on the stage. Go to Actions-Movie Clip Panel below the Stage.
    Copy this Action Script in the Dialog Box as seen below, to give the random movement to the movie clip:

    onClipEvent(enterFrame)
    {
    _alpha=random(100);
    _x=_x=random(50);
    _y=_y=random(50);
    }



    Repeat this for the heart moview clip. You can enter different values instead of 100 and 50 and experiment to see which looks the best.

  5. Select the dot and copy and paste it to various places in the stage. Repeat this step 5 times and adjust the dots in the Stage by dragging them next to each other in different places. You can repeat the steps as many times as you want and change the values to give different movement. Copy and paste the heart in various places as well.

  6. Save your file as random.fla. Press on Ctrl+Enter to see the Random Movement. This will create automatically random.swf file.

Congratulations! Your Flash Random Movement Effect is ready.

Download the .fla file


Now building a website is as easy as 1-2-3!

Please Like, Tweet, Share or Comment on this page if you found this tutorial/resource useful!

No portion of these materials may be reproduced in any manner whatsoever, without the express written consent of Entheos. Any unauthorized use, sharing, reproduction or distribution of these materials by any means, electronic, mechanical, or otherwise is strictly prohibited.


Looking for high-quality Flash Website Design? Choose from over 6000 templates!

Gorgeous Page Roll Image Transition Effect in Flash

Creating Page Curl Transition

Creating a Rotating 3D Planet in Flash

Creating Realistic 3D Planet

Best Flash Photo Gallery Website Templates

Best Flash Photo Gallery Website Templates

Burning Image Effect in Flash

maskmn_image055

Realistic Rippling Water Animation in Flash

r_water

Awesome 3D Flash Website Templates

Awesome 3D Flash Website Templates

 

Featured Template
Template # 53694
Type: PrestaShop
Price: $139

Flash Photo Galleries