Developing Webs logo
Google
Web DW-Main DW-Photoshop
Visit the message board for solutions or post a question Check out the Classes offered for free at Developing Webs Voice Chat submit a tutorial, resources, article, font for publication consideration and earn a one way link back to your site Get more specifics about the Developing Webs Voice chat room and its room members View the current news at Developing Webs alternative sites which are resources for your d3evelopment needs Join Developing Webs Chat Link to us on your web page to help support this resource! Check out Developing Webs At yahoo groups! Developing Webs Home Adobe Photoshop Tutorials Macromedia Flash Tutorials Jasc Paint Shop Pro Tutorials Adobe Illustrator Animation basics Some Basic PHP tutorials Perl Tutorials HTML Tutorials Cascading Style Sheets javascript Front Page Tutorials Macromedia Dream Weaver Tutorials dreamweaver Publishing your site, FTP, ChMod, Promotions
RSS Newsfeed
for your site
DW News
Calendar
DW Forum
Right click on button and copy shortcut

Add to My Yahoo!

Reminder
Remember to book mark this site!



Request a Tutorial

Scripting Additional Instances

See the movie on the right=>
and download the FLA here

This will show you how you can insert additional instances of a movie clip in your movie by a simple action script.

 

1. Create a movie clip of your choice. The clip we used was a fly following a motion guide.

2. Place your movie clip on the stage.

3. Name your instance on the instance panel fly_1

4. Draw a circle, highlight it,  and convert it to a symbol that has properties of a button.

5. We are now ready to script multiple instances! Click on your button to highlight it.

6. On the actions panel,

  • Click the + => actions => evaluate.
  • Click the target button on the action panel and find the fly_1, click ok.
  • Click + => objects => Movie clips => duplicateMovieClip
  • name the new clip "fly_"+"x" and Select a new level x, so that it will look like this:
    "fly_"+"x", x . Make sure you have the "" where you need them.
  • Click the + => actions => evaluate
  • To change the value of X, Type in x++

Your script should look like this:

7. Play your movie. You will see that you will increase the number of movie clips by 1 with each click of the button. With this example, the fly_ clips are loaded all at the same _x, _y coordinates. You can change these by adding a setproperty script to this onrelease statement. SetProperty was covered 2 weeks ago in this tutorial. You will use the property of _x and then _y to adjust the coordinates for starting position. You may want to try setting a random number between 0 and 500 for this and your flys will be all over.

8. Setting different positions

Try this script on a second button:

9.  The same could be done with _xscale, _yscale, rotation, and many other properties. Have fun experimenting with your fly clip!



"Building The Web Into a Nicer Place -- One Site At A Time"
Developing Webs Group Copyright © 2001-2026 All Rights Reserved
Privacy and Legal