AS3 Target an active Movieclip / Sprite

msukow
msukow used Ask the Experts™
on
I have been able to dynamically add a textfield to the stage and can drag / drop. I have a button on the stage that when clicked, should center the MovieClip / Sprite horizontally. The problem is that the following code targets the button clicked (which makes sense):

private function centerHorizontally(e:MouseEvent):void {
    var thisSprite:Sprite = e.target.parent;
    trace(thisSprite.x);
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2009

Commented:
the textfield is in a movieclip?

do you have a document class?
if so you can do the following

(DocumentClassName)root.movieclipname.x;


Author

Commented:
My document class name is CoreModule.as.

I tried the following but no good:
CoreModule.root.movieclipname.x;
and
(CoreModule).root.movieclipname.x;
Top Expert 2009

Commented:
can you upload your files. will be easier to debug and check it that way.
Commented:
This project has been placed on hold.

Author

Commented:
This is incomplete because the project is now on hold.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial