[FLASH 8 actionscript] Desperately need help with compass

[FONT=Arial][SIZE=2]i’ve gone through several forums and tutorials to figure out how to make a compass react to a magnet. i’m quite new to flash and i’m an entry level in my company and they want me to create this simple animation and i’m already having problems with it :*(
i’ve specifically told them that my experience with flash is limited but now they want me to become an instant expert at it!

i know how to use flash but my actionscripting skills are terrible, especially with the math stuff. i’ve seen several tutorials of an arrow attracted to the mouse cursor point but i haven’t seen any that shows an arrow repelling away from a cursor. i’ve used this [COLOR=Black]example:

[/COLOR][COLOR=Black][FONT=Tahoma]http://www.flashkit.com/movies/Scripting/Maths/Detect_a-Mark_Otw-4100/index.php[/FONT][/COLOR][COLOR=Black][FONT=Tahoma]
[/FONT][/COLOR][COLOR=navy][COLOR=navy][FONT=Tahoma]
[COLOR=Black]
[/COLOR][/FONT][/COLOR][/COLOR][COLOR=navy][COLOR=navy][FONT=Tahoma][COLOR=Black] but the coding was a bit too complex so i ended up using the coding (sorry don’t mean to steal…using for practice purpose!) from some other tutorial which i can’t seem to find right now.

[FONT=Arial]I AM TRYING TO ACHIEVE:[/FONT][/COLOR][/FONT][/COLOR][/COLOR][/SIZE][/FONT][FONT=Arial][SIZE=2]

  1. http://webphysics.davidson.edu/mjb/SESAPS2000/magnets.html
    (this is the javascript version…you have to click on “Animation 2” and “Add compass”)

[/SIZE][/FONT] [FONT=Arial][SIZE=2]OR

[/SIZE][/FONT] [FONT=Arial][SIZE=2]2. http://www.edumedia.fr/a179_l2-bar-magnet-2.html
(i need the opposite of this where I can move the compass instead of the magnet)

[/SIZE][/FONT] [FONT=Arial][SIZE=2]can someone please please help? i need to present this to my bosses by the end of the week! can anyone recommend a good actionscript book that will help shed some light for me? :cantlook:

SO FAR:
i am able to drag my compass around the magnet which is centered on the stage. i have two movie clips called point_N and point_S and i’m trying to get the compass to either attract or repel when put near the ends of the magnet. this is the code i have so far on the compass movie clip:

[/SIZE][/FONT] [FONT=Arial][SIZE=2][COLOR=Gray] //trying to get the compass to react to point_N of the magnet!
//not working correctly…
//movieclips point_S and point_N are currently visible for aid purposes…
//i intend to put them underneath the magnet in the end…if i ever get this figured out![/COLOR][/SIZE][/FONT][FONT=Arial][SIZE=2]
[COLOR=Gray]//overall, reacts funny[/COLOR]

[/SIZE][/FONT] [FONT=Arial][SIZE=2][COLOR=Navy] onClipEvent (enterFrame) {
mouse_x = int(_root.point_N._x-this._x);
mouse_y = int(_root.point_N._y-this._y);
if (mouse_x>0 && mouse_y>0) {
quad = Number(4);
}
if (mouse_x<0 && mouse_y>0) {
quad = Number(1);
}
if (mouse_x<0 && mouse_y<0) {
quad = Number(2);
}
if (mouse_x>0 && mouse_y<0) {
quad = Number(3);
}

abs_x = Math.abs(mouse_x);
abs_y = Math.abs(mouse_y);
tg = abs_y/abs_x;
_root.maths = Math.atan(tg)*Number(180)/Math.PI;
 if (quad == 1) { angle = number(90) + number(_root.maths) }
if (quad == 2) { angle = number(90) - number(_root.maths) }
 if (quad == 3) { angle = number(270) - number(_root.maths) }
 if (quad == 4) { angle = number(270) + number(_root.maths) }
setProperty (_this, _rotation, angle);

}

[/COLOR][/SIZE][/FONT] [FONT=Arial][SIZE=2]

this is the code i have on the compass’s hit area (which allows me to drag and move it)

[/SIZE][/FONT] [FONT=Arial][SIZE=2][COLOR=Navy] on (press) {
startDrag(this, true, 15, 15, 535, 435);
this.swapDepths(_root.x );
}
on (release) {
stopDrag();
}[/COLOR][/SIZE][/FONT][FONT=Arial][SIZE=2]

I hope someone can help me! i know this is very simple but stupid me can’t figure this thing out! i’d really appreciate your help.[/SIZE][/FONT]