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 Tools to help you create your site Free and shareware fonts to download Photographs to use in your projects Shop for your site needs Free Online classes REcommend this site to others Log in or edit your information when logged in Developingwebs Log Out Change My Account details and preferences
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

Coin 8: Changing the position of the coin on the stage after click.

1. Open your coin movie. Double click on the coin movie clip on the main stage. The current timeline of the coin1 movie clip has 6 frames, The first frame has the button in it and a stop. The additional frames are for the breaking up of the coin after it was clicked.


To make the movie more interesting, we can reposition the coin after it breaks up and returns to the frame 1. The _x position is regulated by the variable mania, and the _y variable is regulated by the variable ruby.

Click in frame 6 of the actions layer of the movie clip. Hit your F7 key to insert a blank keyframe. Highlight the frame and open your action panel.

2. First we need to reset mania using set variable. Click Actions=> variables=> set variable. In the variable field type in the path to the variable <dot> mania, or _root.mania. Click in the value field. We need to generate a random whoile number for x between 0 and 550, or the width of the stage. To do this we will Use round to generate a whole number. Click Objects=> core=> math=> methods=> round. Click in the bracket for the parameters for Math.round. Add the script for random by going objects=> core=> math=> method=> random. After this is placed in the brackets we need to add the multiplier to set the random number between 0 and 550, by adding * 500. Check expression so it is calculated. The result will look like this:

_root.mania = Math.round(Math.random()*550);

3. To reset ruby we use set variable again. Click back on your bottom script in the script panel so the new script goes under the last. Click Actions=> variables=> set variables. In the variable field type in the path to the variable <dot> ruby, or _root.ruby. Click in the value field. Click Objects=> core=> math=> methods=> round. Click in the bracket for the parameters for Math.round. Add the script for random by going objects=> core=> math=> method=> random. After this is placed in the brackets we need to add the multiplier to set the random number between 0 and 400, by adding * 400. Check expression so it is calculated. The result will look like this:

_root.ruby = Math.round(Math.random()*400);

The coin will now change position after it breaks up.

The next tutorial sets up starting and ending screens and a time limit.



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