First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Siddharth

Correcting the X and Y co-ordinates

Ok, now you must be wondering what is xcorrect and ycorrect? They are nothing but simple variables to correct the X and Y coordinates of the MovieClip. If you use HitTest without making provisions for Xcorrect or YCcorrect, you may not get the desired result.

When you draw something and then convert it into a MovieClip, you will notice that a small circle appears at the centre of the MovieClip. This centre actually acts as the X and Y coordinate for the Movie. You can picture it like this:

You can see that the X and Y are located at the centre of the MovieClip whereas it should have been at the top left-most corner. So, to get the actual X and Y co-ordinates, subtract half the MovieClip's width from its _x co-ordinate and subtract half the MovieClip's height from its _y co-ordinate.
» Level Intermediate

Added: 2006-03-18
Rating: 5.67 Votes: 6
» Author
Studying in College, 19 years old
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.