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
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
why not use syntax like
_root.parent_mc._x
why are you doing
_root["parent_mc"]._x
that??? if your parent_mc is a named instance of a movie clip just use
_root.parent_mc._x
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
post a fla…then i can attempt to fix it 
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
^^ only file share i know…FLA is to big to attach
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
thanks fizix…im getting closer now…cant quite get it right but at least now it seems to be taking rotation into acct
bah im getting frusterated…I cant get this crap to place right
i cant download your fla that stupid file share is being annoying…
ill pm you my email address ok…