PDA

View Full Version : HELP! How do I copy and then specify current x, y coords onto a duplicated mc?


zedtag
11-10-2004, 08:23 PM
Problem:
I am duplicating a mc from a scrollpane to the _root level. This allows me to have drag and drop functionality outside of the scrollpane. The problem I have now is that I am not sure how to specify the current x, y coords of the original mc within the scrollpane.

note: I am duplicating a mc outside of the scrollpane, because the scrollpane does not allow me to drag and drop outside of the scrollpane.

How can I get x, y coords from a movie within a scrollpane? I need these coordinates to tell a duplicated mc where to land.

brolife
11-10-2004, 11:41 PM
in your code just use trace();
ie.

trace(mc._y);
trace(mc._x);

when you test your movie in flash the co-ordinates will be displayed in the output box.

you should get in the habit of using it, helps alot in debugging.

Tower2
11-11-2004, 06:21 AM
Is this what you are after?
_root.duplicatedMC._y = _root.scrollpane.mc._y
_root.duplicatedMC._x = _root.scrollpane.mc._x

zedtag
11-12-2004, 04:10 PM
Tower2,

In your example "_root.scrollpane.mc._y" is scrollpane an instance name or identifier of some sort?

Is this what you are after?
_root.duplicatedMC._y = _root.scrollpane.mc._y
_root.duplicatedMC._x = _root.scrollpane.mc._x

best,
a

zedtag
11-12-2004, 05:05 PM
Attached is my test fla which creates a movie clip outside of the scrollpane, but I still need to figure out how to tell my mc to land directly above one of the bars in the scrollpane. If anyone can take a really quick stab at making it work and shooting it back or sending me some info I would be in your favor!

note: the mc must land above the white bar and must land above it if the scrollbar has been adjusted.

All the best,
Abe

Tower2
11-15-2004, 01:14 AM
In the future you may want to look at attaching movie clips and duplicating them, but as a quick fix to your problem try the following...

Frame 2 of white_drag
stop();
this._x = _root.tempX;
this._y = _root.tempy;

And on you instance of white
on (release) {
_root.tempX = this._x;
_root.tempy = this._y;
_root.whiteDrag.gotoAndStop(2);
}