# Help pls hehe \_x,\_y of a MC in a MC

**URL:** <https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273>\
**Category:** Uncategorized\
**Created:** [April 12, 2006, 4:57am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273 "2006-04-12T04:57:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 4:57am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/1 "2006-04-12T04:57:12Z")

</div>

Im trying to get the X, Y of a Movie clip (well call it “target\_mc”)  
its inside of a parent MC (well call it…“parent\_mc”)

but im trying to get the X,Y as they relate to the main stage(\_root)

so far the two methods ive used are

```auto

this._x = _root["parent_mc"]._x + _root["parent_mc"]["target_mc"]._x
    this._y = _root["parent_mc"]._y + _root["parent_mc"]["target_mc"]._y

```

and  
bullet.\_x = \_root[“MainChar\_mc”].\_x  
bullet.\_y = \_root[“MainChar\_mc”].\_y

neither worked  
it seemed like the first method(the one in the code block) places it at the starting position of the MC i need the location of

but to further complicate it the parent\_mc is a rotating clip(Ive got code to make it follow the mouse)

anyway if anyone knows how i can place this in a location that is changing whenever the mouse moves please help

if figure there must be some way i can do something like  
this.\_x =\_ymouse - ( \_root[“parent\_mc”].\_x + \_root[“parent\_mc”][“target\_mc”].\_x)

or something to position the object dynamically where its supposed to be

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 12, 2006, 5:00am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/2 "2006-04-12T05:00:38Z")

</div>

why not use syntax like

```auto

_root.parent_mc._x

```

why are you doing

```auto

_root["parent_mc"]._x

```

that??? if your parent\_mc is a named instance of a movie clip just use

```auto

_root.parent_mc._x

```

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 5:56am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/3 "2006-04-12T05:56:05Z")

</div>

bah whatever its the same 😛

anyway back too my original question how can i get the position of a movieclip nested in a movieclip

parent\_mc.target\_mc.\_x gives me target\_mc’s X value in relation to parent\_mc which is fine if the clip was stationary…but it isnt taking into effect rotation of the parent movie clip when it returns the targets location

Ive attached an Image of Parent MC the Black box is the Target\_mc

it returns x = -35 y -70 (which is correct when its vertical)  
if i rotate the whole movie clip (parent\_mc) 45 degrees  
it still returns c = -35 , y = -70 (the x y values if it wasnt rotated)

the pink dot on the nose is the point at which the movie clip rotates around

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 12, 2006, 5:59am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/4 "2006-04-12T05:59:44Z")

</div>

post a fla…then i can attempt to fix it 😃

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 6:27am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/5 "2006-04-12T06:27:40Z")

</div>

hehe  
sorry they look so bad…havent been commenting much i commented some and tried to point out the part im having trouble with (near the bottom)

its all AS pretty much

```
http://rapidshare.de/files/17793846/Square_Spiral.mx.fla.html

```

[http://rapidshare.de/files/17793872/Square\_Spiral.fla.html](http://rapidshare.de/files/17793872/Square_Spiral.fla.html)

^^ only file share i know…FLA is to big to attach

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 12, 2006, 1:00pm UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/6 "2006-04-12T13:00:35Z")

</div>

ok will check em out

---

<div class="post-metadata">

**Author:** ![FizixMan](https://avatars.discourse-cdn.com/v4/letter/f/e9c0ed/32.png) [@FizixMan](https://forum.kirupa.com/u/FizixMan)\
**Post date:** [April 12, 2006, 3:19pm UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/7 "2006-04-12T15:19:24Z")

</div>

You can use the localToGlobal and globalToLocal functions to determine what the child MC’s \_x, \_y coordinates are relative to the \_root. (or any other object)

[http://livedocs.macromedia.com/flash/mx2004/main\_7\_2/00001521.html](http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001521.html)

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 3:31pm UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/8 "2006-04-12T15:31:59Z")

</div>

thanks fizix…im getting closer now…cant quite get it right but at least now it seems to be taking rotation into acct

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 5:38pm UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/9 "2006-04-12T17:38:58Z")

</div>

bah im getting frusterated…I cant get this crap to place right

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 12:05am UTC](https://forum.kirupa.com/t/help-pls-hehe--x--y-of-a-mc-in-a-mc/185273/10 "2006-04-13T00:05:33Z")

</div>

i cant download your fla that stupid file share is being annoying…

ill pm you my email address ok…
