i need
i need
Last edited by BiGg RiE; September 18th, 2008 at 10:11 AM.
Umm...
This sounds like a fairly simple point & click type thing right? Set up each city to be a button or a movie clip, and put them in a container clip. Add a CLICK listener to the container that checks which clip has been targeted. if the user doesn't click the correct city, use the distance formula to calculate the distance from the mouse click to the correct city & do whatever you want after that.
you = function(){
setEnabled( true );
live();
setEnabled( false );
}
thanks, but what is the distance formula?
Here's an example
Last edited by BiGg RiE; September 18th, 2008 at 10:11 AM.
The distance formula measures the distance between 2 points. It's based upon the Pythagorean Theorem  the relationship of the sides of a righttriangle.
// Whereas A, B, and C are the lengths of each side and C is the hypotenuse.
A squared + B squared = C squared
Anyhow, you'll tweak that to get to the distance formula you'd use in flash:
EDIT: Google is your friendCode:Distance = Math.sqrt( (x2x1)*(x2x1) + (y2y1)*(y2y1) );
you = function(){
setEnabled( true );
live();
setEnabled( false );
}
Ok, so
Last edited by BiGg RiE; September 18th, 2008 at 10:11 AM.
1. Math.ceil() and Math.floor() will round your numbers. ceil rounds up, floor rounds down.
Usage: var roundedDistance = Math.ceil( myDecimalNumberTobeRounded );
2. I'll maybe post your code to your project on here later
Last edited by therobot; July 3rd, 2008 at 01:37 PM.
you = function(){
setEnabled( true );
live();
setEnabled( false );
}
Ok, I'm
Last edited by BiGg RiE; September 18th, 2008 at 10:12 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
