|
-
bibuti.
movieclip _x relative to _root._x
i KNOW i've been through this situation before, but i can't recall how i did it.
i'm making a jeopardy template for a fellow goon, and i'm making each question box an instance of one movieclip.
what i want to happen is when the user clicks on the question they want, the question box repositions itself to the center x and y of the screen, and also scales to take up the whole screen.
so far i've got it to work, but only from ONE position on the board.
for example, if the question box is on the left side of the board, it works fine. yet, if i place the question box on the right side or lower on the board, it still only repositions to the center of the question box's x position, not the root.
what do i need to put in the question box's code to make the variables involving x and y to reposition according to the ROOT x and y?
again, i KNOW this is simple, but it's late for me and i can NOT find the solution i had before.
thanks.
nolen
i'm obsessed with video games.
-
Senior Member
Assuming the crosshairs are lined up the box's top/left corner, this should do it:
box._x = 0;
box._y = 0;
box._width = Stage.width;
box._height = Stage.height;
If the crosshairs are lined up with the box's center, then this should do it:
box._x = Stage.width/2;
box._y = Stage.height/2;
box._width = Stage.width;
box._height = Stage.height;
If _root._x and _root._y is not 0,0, then use _root.globalToLocal() and add that value to box._x and box._y.
pt = {x:0,y:0};
_root.globalToLocal(pt);
box._x += pt.x;
box._y += pt.y;
Last edited by jbum; 05-31-2004 at 01:33 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|