RE: [Flashcoders] urgent angle problem

2008-02-05 Thread Keith Reinfeld

frame = Math.ceil(((angle <  0)? -1*(angle): -1*(angle - 360))/40); 


Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
 



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Fumio Nonaka

angle = (angle%360+360)%360;

Then:
810 -> 90
-810 -> 270
_
Bob Leisle wrote:

if (angle < 0) {
  angle += 360;
}

--
Fumio Nonaka
mailto:[EMAIL PROTECTED]
http://www.FumioNonaka.com/
My books
Flash community
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] urgent angle problem

2008-02-05 Thread Dave Watts
> Oh, sorry Glen & List. This was the mail sent out from me. Is 
> the List dodgy again???

No, it's something on your end.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Training: Adobe/Google/Paperthin Certified Partners
http://training.figleaf.com/

WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers!
http://www.webmaniacsconference.com/
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Bob Leisle

er...make that

if (angle < 0) {
  angle += 360;
}


Bob Leisle wrote:

Hi Allandt,

How about something like this?
if (angle < 0) {
   angle += 180;
}

hth,
Bob


Allandt Bik-Elliott (Receptacle) wrote:

hi guys

i have a problem that i need to sort out - i have a script that 
checks to see where the mouse pointer is in relation to a point of 
origin and then selects which frame from a group of 9 to show


the problem i'm having is that if the angle is above 180 degrees, it 
swaps to negative numbers back down to 0 (go to 
http://www.19.5degs.com/element/215.php to see an example - in 
particular watch the text frame as you move) and i need to figure out 
how to make it a full 360


i've tried

if (angle<<0) {
angle = (-1*angle)+180;
}

but that's not right

here is my code

//image frame selector
function changeFrame(clip:MovieClip, angle:Number):Void {

// frame is receiving a wrong number above 180 degrees here
// there are 9 frames so i want each frame to have 40 degrees 
(hence angle/40)

var frame:Number = Math.round(angle/40);

// visibleClip is a variable set on all clips (set in the 
mousemove below) to tell my script which clip is visible to make it 
invisible without having to loop through the other clips when there's 
a change

clip[clip.visibleClip]._visible = false;
clip["p"+frame]._visible = true;
clip.visibleClip = ["p"+frame];

}

//mouse follower
var mouseListener:Object = new Object();
mouseListener.lookAt = function(clip:MovieClip, originX:Number, 
originY:Number, watchX:Number, watchY:Number):Void {


var adjside:Number = watchX - originX;
var oppside:Number = -1*(watchY - originY);
var angle:Number = Math.atan2(oppside, adjside); // in radians
var angle:Number = Math.round(angle/Math.PI*180); // convert to 
degrees

var angle:Number = -1*(angle); // invert
changeFrame(clip, angle);

}
mouseListener.onMouseMove = function () {

var watchX:Number = _xmouse;
var watchY:Number = _ymouse;
// there are 8 images that are trying to do this
for (var i:Number=1; i<9; i++) {
var thisPerson:MovieClip = content_mc["person"+i];
this.lookAt(thisPerson, thisPerson._x, thisPerson._y, 
_root._xmouse, _root._ymouse);

}
};
Mouse.addListener(mouseListener);


hope you can help
alz


Allandt Bik-Elliott
Receptacle
t  01920 413 947  |  m  07970 718 545
e [EMAIL PROTECTED]

This e-mail is confidential and may be privileged. It is for the use 
of the named recipient(s) only. If you have received it in error, 
please notify us immediately. Please do not copy or disclose its 
contents to anyone, and delete it from your computer systems. Please 
note that information sent by e-mail can be corrupted. This e-mail 
has been prepared using information believed by the author to be 
reliable and accurate, but the Company makes no warranty as to its 
contents. Any opinions expressed are those of the author and do not 
necessarily reflect the opinions of the Company.



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--No virus found in this incoming message.
Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 
269.19.20/1260 - Release Date: 2/5/2008 9:44 AM







--
Thanks,
~
Bob Leisle 
Headsprout Software & Engineering

http://www.headsprout.com
Where kids learn to read! 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Kenneth Kawamoto
Oh, sorry Glen & List. This was the mail sent out from me. Is the List 
dodgy again???


--

Try:

if (angle<0) {
   angle += 360;
}


Kenneth Kawamoto
http://www.materiaprima.co.uk/

Glen Pike wrote:

Dude, how come you keep sending empty emails to the list??

Kenneth Kawamoto wrote:

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01736 759321
www.glenpike.co.uk 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Glen Pike

Dude, how come you keep sending empty emails to the list??

Kenneth Kawamoto wrote:

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


--

Glen Pike
01736 759321
www.glenpike.co.uk 

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Bob Leisle

Hi Allandt,

How about something like this?
if (angle < 0) {
   angle += 180;
}

hth,
Bob


Allandt Bik-Elliott (Receptacle) wrote:

hi guys

i have a problem that i need to sort out - i have a script that checks 
to see where the mouse pointer is in relation to a point of origin and 
then selects which frame from a group of 9 to show


the problem i'm having is that if the angle is above 180 degrees, it 
swaps to negative numbers back down to 0 (go to 
http://www.19.5degs.com/element/215.php to see an example - in 
particular watch the text frame as you move) and i need to figure out 
how to make it a full 360


i've tried

if (angle<<0) {
angle = (-1*angle)+180;
}

but that's not right

here is my code

//image frame selector
function changeFrame(clip:MovieClip, angle:Number):Void {

// frame is receiving a wrong number above 180 degrees here
// there are 9 frames so i want each frame to have 40 degrees 
(hence angle/40)

var frame:Number = Math.round(angle/40);

// visibleClip is a variable set on all clips (set in the 
mousemove below) to tell my script which clip is visible to make it 
invisible without having to loop through the other clips when there's 
a change

clip[clip.visibleClip]._visible = false;
clip["p"+frame]._visible = true;
clip.visibleClip = ["p"+frame];

}

//mouse follower
var mouseListener:Object = new Object();
mouseListener.lookAt = function(clip:MovieClip, originX:Number, 
originY:Number, watchX:Number, watchY:Number):Void {


var adjside:Number = watchX - originX;
var oppside:Number = -1*(watchY - originY);
var angle:Number = Math.atan2(oppside, adjside); // in radians
var angle:Number = Math.round(angle/Math.PI*180); // convert to 
degrees

var angle:Number = -1*(angle); // invert
changeFrame(clip, angle);

}
mouseListener.onMouseMove = function () {

var watchX:Number = _xmouse;
var watchY:Number = _ymouse;

// there are 8 images that are trying to do this

for (var i:Number=1; i<9; i++) {
var thisPerson:MovieClip = content_mc["person"+i];
this.lookAt(thisPerson, thisPerson._x, thisPerson._y, 
_root._xmouse, _root._ymouse);

}
};
Mouse.addListener(mouseListener);


hope you can help
alz


Allandt Bik-Elliott
Receptacle
t  01920 413 947  |  m  07970 718 545
e [EMAIL PROTECTED]

This e-mail is confidential and may be privileged. It is for the use 
of the named recipient(s) only. If you have received it in error, 
please notify us immediately. Please do not copy or disclose its 
contents to anyone, and delete it from your computer systems. Please 
note that information sent by e-mail can be corrupted. This e-mail has 
been prepared using information believed by the author to be reliable 
and accurate, but the Company makes no warranty as to its contents. 
Any opinions expressed are those of the author and do not necessarily 
reflect the opinions of the Company.



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--No virus found in this incoming message.
Checked by AVG Free Edition.Version: 7.5.516 / Virus Database: 
269.19.20/1260 - Release Date: 2/5/2008 9:44 AM





--
Thanks,
~
Bob Leisle 
Headsprout Software & Engineering

http://www.headsprout.com
Where kids learn to read! 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Glen Pike

Hi,

You make both values absolute and calculate your angle, then 
subtract 90 from the degrees.


   You have to detect whether adj  is negative and if so, add 180 to 
your angle or something similar if I remember...


var adjside:Number = watchX - originX;
   var oppside:Number = -1*(watchY - originY);
   var angle:Number = Math.atan2(Math.abs(oppside), Math.abs(adjside)); 
// in radians
   var angle:Number = Math.round(angle/Math.PI*180) - 90; // convert to 
degrees
  
   if(0 > adside) {

  angle += 180;
   }

   var angle:Number = -1*(angle); // invert

Allandt Bik-Elliott (Receptacle) wrote:

hi guys

i have a problem that i need to sort out - i have a script that checks 
to see where the mouse pointer is in relation to a point of origin and 
then selects which frame from a group of 9 to show


the problem i'm having is that if the angle is above 180 degrees, it 
swaps to negative numbers back down to 0 (go to 
http://www.19.5degs.com/element/215.php to see an example - in 
particular watch the text frame as you move) and i need to figure out 
how to make it a full 360


i've tried

if (angle<<0) {
angle = (-1*angle)+180;
}

but that's not right

here is my code

//image frame selector
function changeFrame(clip:MovieClip, angle:Number):Void {

// frame is receiving a wrong number above 180 degrees here
// there are 9 frames so i want each frame to have 40 degrees 
(hence angle/40)

var frame:Number = Math.round(angle/40);

// visibleClip is a variable set on all clips (set in the 
mousemove below) to tell my script which clip is visible to make it 
invisible without having to loop through the other clips when there's 
a change

clip[clip.visibleClip]._visible = false;
clip["p"+frame]._visible = true;
clip.visibleClip = ["p"+frame];

}

//mouse follower
var mouseListener:Object = new Object();
mouseListener.lookAt = function(clip:MovieClip, originX:Number, 
originY:Number, watchX:Number, watchY:Number):Void {


var adjside:Number = watchX - originX;
var oppside:Number = -1*(watchY - originY);
var angle:Number = Math.atan2(oppside, adjside); // in radians
var angle:Number = Math.round(angle/Math.PI*180); // convert to 
degrees

var angle:Number = -1*(angle); // invert
changeFrame(clip, angle);

}
mouseListener.onMouseMove = function () {

var watchX:Number = _xmouse;
var watchY:Number = _ymouse;

// there are 8 images that are trying to do this

for (var i:Number=1; i<9; i++) {
var thisPerson:MovieClip = content_mc["person"+i];
this.lookAt(thisPerson, thisPerson._x, thisPerson._y, 
_root._xmouse, _root._ymouse);

}
};
Mouse.addListener(mouseListener);


hope you can help
alz


Allandt Bik-Elliott
Receptacle
t  01920 413 947  |  m  07970 718 545
e [EMAIL PROTECTED]

This e-mail is confidential and may be privileged. It is for the use 
of the named recipient(s) only. If you have received it in error, 
please notify us immediately. Please do not copy or disclose its 
contents to anyone, and delete it from your computer systems. Please 
note that information sent by e-mail can be corrupted. This e-mail has 
been prepared using information believed by the author to be reliable 
and accurate, but the Company makes no warranty as to its contents. 
Any opinions expressed are those of the author and do not necessarily 
reflect the opinions of the Company.



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




--

Glen Pike
01736 759321
www.glenpike.co.uk 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] urgent angle problem

2008-02-05 Thread Kenneth Kawamoto

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] urgent angle problem

2008-02-05 Thread Steve Abaffy
Just add 360 that should do it. But I wander if in your code you have if
(angle << 0) shouldn't that be if (angle < 0)???

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Allandt
Bik-Elliott (Receptacle)
Sent: Tuesday, February 05, 2008 11:11 AM
To: flashcoders
Subject: [Flashcoders] urgent angle problem

hi guys

i have a problem that i need to sort out - i have a script that  
checks to see where the mouse pointer is in relation to a point of  
origin and then selects which frame from a group of 9 to show

the problem i'm having is that if the angle is above 180 degrees, it  
swaps to negative numbers back down to 0 (go to http://www. 
19.5degs.com/element/215.php to see an example - in particular watch  
the text frame as you move) and i need to figure out how to make it a  
full 360

i've tried

if (angle<<0) {
angle = (-1*angle)+180;
}

but that's not right

here is my code

//image frame selector
function changeFrame(clip:MovieClip, angle:Number):Void {

// frame is receiving a wrong number above 180 degrees here
// there are 9 frames so i want each frame to have 40 degrees (hence

angle/40)
var frame:Number = Math.round(angle/40);

// visibleClip is a variable set on all clips (set in the mousemove

below) to tell my script which clip is visible to make it invisible  
without having to loop through the other clips when there's a change
clip[clip.visibleClip]._visible = false;
clip["p"+frame]._visible = true;
clip.visibleClip = ["p"+frame];

}

//mouse follower
var mouseListener:Object = new Object();
mouseListener.lookAt = function(clip:MovieClip, originX:Number,  
originY:Number, watchX:Number, watchY:Number):Void {

var adjside:Number = watchX - originX;
var oppside:Number = -1*(watchY - originY);
var angle:Number = Math.atan2(oppside, adjside); // in radians
var angle:Number = Math.round(angle/Math.PI*180); // convert to
degrees
var angle:Number = -1*(angle); // invert
changeFrame(clip, angle);

}
mouseListener.onMouseMove = function () {

var watchX:Number = _xmouse;
var watchY:Number = _ymouse;

// there are 8 images that are trying to do this
for (var i:Number=1; i<9; i++) {
var thisPerson:MovieClip = content_mc["person"+i];
this.lookAt(thisPerson, thisPerson._x, thisPerson._y,  
_root._xmouse, _root._ymouse);
}
};
Mouse.addListener(mouseListener);


hope you can help
alz


Allandt Bik-Elliott
Receptacle
t  01920 413 947  |  m  07970 718 545
e [EMAIL PROTECTED]

This e-mail is confidential and may be privileged. It is for the use  
of the named recipient(s) only. If you have received it in error,  
please notify us immediately. Please do not copy or disclose its  
contents to anyone, and delete it from your computer systems. Please  
note that information sent by e-mail can be corrupted. This e-mail  
has been prepared using information believed by the author to be  
reliable and accurate, but the Company makes no warranty as to its  
contents. Any opinions expressed are those of the author and do not  
necessarily reflect the opinions of the Company.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] urgent angle problem

2008-02-05 Thread Allandt Bik-Elliott (Receptacle)

hi guys

i have a problem that i need to sort out - i have a script that  
checks to see where the mouse pointer is in relation to a point of  
origin and then selects which frame from a group of 9 to show


the problem i'm having is that if the angle is above 180 degrees, it  
swaps to negative numbers back down to 0 (go to http://www. 
19.5degs.com/element/215.php to see an example - in particular watch  
the text frame as you move) and i need to figure out how to make it a  
full 360


i've tried

if (angle<<0) {
angle = (-1*angle)+180;
}

but that's not right

here is my code

//image frame selector
function changeFrame(clip:MovieClip, angle:Number):Void {

// frame is receiving a wrong number above 180 degrees here
	// there are 9 frames so i want each frame to have 40 degrees (hence  
angle/40)

var frame:Number = Math.round(angle/40);

	// visibleClip is a variable set on all clips (set in the mousemove  
below) to tell my script which clip is visible to make it invisible  
without having to loop through the other clips when there's a change

clip[clip.visibleClip]._visible = false;
clip["p"+frame]._visible = true;
clip.visibleClip = ["p"+frame];

}

//mouse follower
var mouseListener:Object = new Object();
mouseListener.lookAt = function(clip:MovieClip, originX:Number,  
originY:Number, watchX:Number, watchY:Number):Void {


var adjside:Number = watchX - originX;
var oppside:Number = -1*(watchY - originY);
var angle:Number = Math.atan2(oppside, adjside); // in radians
var angle:Number = Math.round(angle/Math.PI*180); // convert to degrees
var angle:Number = -1*(angle); // invert
changeFrame(clip, angle);

}
mouseListener.onMouseMove = function () {

var watchX:Number = _xmouse;
var watchY:Number = _ymouse;

// there are 8 images that are trying to do this
for (var i:Number=1; i<9; i++) {
var thisPerson:MovieClip = content_mc["person"+i];
		this.lookAt(thisPerson, thisPerson._x, thisPerson._y,  
_root._xmouse, _root._ymouse);

}
};
Mouse.addListener(mouseListener);


hope you can help
alz


Allandt Bik-Elliott
Receptacle
t  01920 413 947  |  m  07970 718 545
e [EMAIL PROTECTED]

This e-mail is confidential and may be privileged. It is for the use  
of the named recipient(s) only. If you have received it in error,  
please notify us immediately. Please do not copy or disclose its  
contents to anyone, and delete it from your computer systems. Please  
note that information sent by e-mail can be corrupted. This e-mail  
has been prepared using information believed by the author to be  
reliable and accurate, but the Company makes no warranty as to its  
contents. Any opinions expressed are those of the author and do not  
necessarily reflect the opinions of the Company.



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders