I have a little 360 view rotation thing i made, and now im modifying it to only show part of that view (180), the images i have for this are only 180. I have made a little greyed out spot on the compass and made it stop the arrow from going to that point, but now i need to offset the image that scrolls to be from north to south, but it’s currently scrolling east to west.
Really hard to explain, heres a demo:
http://www.joshuajonah.com/compass.swf
heres the source:
http://www.joshuajonah.com/compass.fla
Heres a little snippet of the code sections:
on the image in the back
onClipEvent (load)
{
_global.degrees = (this._width-1360)/180
}
on(press){
startDrag(this, false)
}
on(release){
this.stopDrag()
}
onClipEvent (enterFrame)
{
_y = 0
}
on the maintimeline:
stop()
face.onPress = function(){
face.onEnterFrame = function(){
mouse_x = mouseTarget._x;
mouse_y = mouseTarget._y;
xDistance = mouseTarget._x - face._x;
yDistance = mouseTarget._y - face._y;
if (Number(xDistance)<0) {
normalise = -1 * xDistance;
} else {
normalise = xDistance;
}
if (Number(yDistance)<0) {
normalise = Number(normalise)+Number((-1 * yDistance));
} else {
normalise = Number(normalise)+Number(yDistance);
}
if ((Number(xDistance)>=0) and (Number(yDistance)>=0)) {
_global.direction = 90*(yDistance/normalise);
} else if ((Number(xDistance)<=0) and (Number(yDistance)>=0)) {
_global.direction = Number(-1*90*(xDistance/normalise))+90;
} else if ((Number(xDistance)<=0) and (Number(yDistance)<=0)) {
_global.direction = Number(-1*90*(yDistance/normalise))+180;
} else {
_global.direction = Number(90*(xDistance/normalise))+270;
}
needle._rotation = _global.direction;
image._x = -_global.direction*_global.degrees
}
}
face.onMouseUp = function(){
killdrag()
}
startmoving()
onEnterFrame = function(){
if (needle._rotation<-90){
needle._rotation = -90
}else if (needle._rotation>90){
needle._rotation = 90
}else{
needle._rotation = -image._x/_global.degrees
}
}
function killdrag(){
delete face.onEnterFrame
}
Any ideas? my brain hurts… thanx for giving it a go for me