Link to home
Start Free TrialLog in
Avatar of msukow
msukowFlag for United States of America

asked on

AS3 Target an active Movieclip / Sprite

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);
}
Avatar of blue-genie
blue-genie
Flag of South Africa image

the textfield is in a movieclip?

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

(DocumentClassName)root.movieclipname.x;


Avatar of msukow

ASKER

My document class name is CoreModule.as.

I tried the following but no good:
CoreModule.root.movieclipname.x;
and
(CoreModule).root.movieclipname.x;
can you upload your files. will be easier to debug and check it that way.
ASKER CERTIFIED SOLUTION
Avatar of msukow
msukow
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msukow

ASKER

This is incomplete because the project is now on hold.