PDA

View Full Version : _x and _y coordinates help



Stilianos
September 23rd, 2006, 08:39 AM
I am trying to get (this) to equal the _x and _y coordinates of P1

onClipEvent(enterFrame){
if(this.hitTest(_root.P1)){
this._x = _root.P1._x
this._y = _root.P1._y
}
}


i used to know how to do it but i forgot.

Anyone w/a solution please post it.

Thanx in advance

Stilianos
September 23rd, 2006, 08:55 AM
never mind figured it out ;)

Stilianos
September 23rd, 2006, 09:00 AM
actualy i have another dilema.

my script:
onClipEvent(enterFrame){
if(this.hitTest(_root.P1)){

_root.f1._x = _root.P1._x
_root.f1._y = _root.P1._y
_root.f1._rotation = _root.P1._rotation
}
}

it doesnt work when i try to link a movie clip in another movie clip for eg:

onClipEvent(enterFrame){
if(this.hitTest(_root.P1)){

_root.f1._x = _root.P1.g1._x
_root.f1._y = _root.P1.g1._y
_root.f1._rotation = _root.P1.g1._rotation
}
}

it would be great if someone could help me out.

Thanx in advance;)

Ps: sorry for triple posting

Joppe
September 23rd, 2006, 09:52 AM
Hmm, firstly, Kierioshimoto, why would he want to attach an circle. Did I miss something or are you totally out wrong?

Secondly, if you trace _root.P1.g1._x, you will notice that its g1's ._x inside the P1 movieclip, so its around 0 thats why it isnt working, look up localToGlobal.

KIERIOSHIMOTO
September 23rd, 2006, 09:55 AM
Deleted my post joppe, sorry man was only trying to help him. Next time I will think twice, you are superior, sorry I tried to help aye. What was i thinking?!?!

nathan99
September 23rd, 2006, 10:09 AM
Ok, Joppe, don't be so rude... he was only trying to help... remember you haven't always been able to do as much stuff as you can now. He is starting up too, so please never become arrogant... I hate that.

Back on topic, do you mean


mc.onEnterFrame = function() {
if (this.hitTest(_root.P1)) {
point = {x:P1.g1._x, y:P1.g1._y};
P1.localToGlobal(point);
f1._x = point.x;
f1._y = point.y;
f1._rotation = P1.g1._rotation;
}
};

Joppe
September 23rd, 2006, 11:23 AM
Was I rude? I only asked why he would want to attach an circle. I was wondering if I read it all wrong, whats so rude and arrogant about it?
Did I ever say I am great? That I am superior Kierioshimoto?

Im sorry that I happen to get confused sometimes, and that when that happen you see me as arrogant and rude.