Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-20-2005, 12:40 AM   #1
daveystew
Dave Stewart
 
daveystew's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 770
Default Moving objects on stage

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?

Thanks!
Dave
daveystew is offline   Reply With Quote
Old 08-29-2005, 08:48 PM   #2
nikomh
Registered User
 
Join Date: Aug 2005
Posts: 3
Default

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];
previousLeft=sel.left;
previousTop=sel.top;

..... 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
nikomh is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:33 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.