View Full Version : Moving objects on stage

08-20-2005, 12:40 AM
I'm none too pleased with the functions to move objects on stage.
Is there an set way to set the exact position of an object using it's registration point?

At the moment I'm blundering about wrapping methods into a custom function - surely it shouldn't be this way!?

I just want something along the lines of selection.moveTo(x,y,useRegistrationPoint).

Any ideas?


08-29-2005, 08:48 PM
found this....

if you can add the item you want to move to a selection it becomes easier.

for example if you have something selected, then you can use this.

// first get the current position of the selected item
var sel = fl.getDocumentDOM().selection[0];

..... then you have the new x and y places,
you must calculate how much positive or negative difference
between the old places and the new places has.

after you know how much you much add or remove from
the x and y positions, use them like this
fl.getDocumentDOM().moveSelectionBy({x:100, y:-100});

in the example the item on the stage moves 100 pixels right from its current position and 100 pixels up from the current y position