| 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!
|