• Home
  • Free Tutorials
  • Free Video Tutorials

Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

Go To Different Spots

Category : Flash Views : 22748
Version : 8 Rating : 
3.0/5 (41 votes)
  • Currently 3.00/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: go-to-different-spots.zip
Result: See the result


Previous | 1 | 2 | 3 | Next

var tga = (map._y - destY) / (map._x - destX);
Here we calculate the tangent to get the angle we need to move.

var ang = (Math.atan(tga) * 180) / Math.PI;
Using the function Math.atan(tangent) we get the radians, but we need the angle so we multiply the radians with 180/Pi.

if (map._x >= destX) {
If the destination coordinate of the map is to the right.

map._x -= speed * Math.cos((ang) * Math.PI / 180); map._y -= speed * Math.sin((ang) * Math.PI / 180);
Move the map in both coordinates using vector math for the amount of pixels in _x and _y.

} else if (map._x <= destX) {
If the destination coordinate of the map is to the left.

map._x += speed * Math.cos((ang) * Math.PI / 180); map._y += speed * Math.sin((ang) * Math.PI / 180);
Move the map.

} NA.onRelease = function() {
Event handler for this button release

_root.destX = 650 _root.destY = 350
Set a new coordinate for the destination and that makes the Map scroll.
The only thing that changes on other button is the coordinates


More cool tech articles from other blogs.

Place your ad here
Loading...


Previous | 1 | 2 | 3 | Next
How to Video Tutorials on software by Helpvids.com

Sponsors





Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.