Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
haspadar

get previous move/scale/rotate states

Recommended Posts

Can I get previous properties of move/scale/rotate in case I'll handle FINISH_INTERACTIVE_MOVE/FINISH_INTERACTIVE_SCALE/FINISH_INTERACTIVE_ROTATE events?

Thanx

Link to comment
Share on other sites

I'm not sure I understand your objective properly, but if you want to record values, you could just listen for SELECTION_CHANGE events to see when new objects are added to the selection and record info (like the transform.matrix values) at that point. Does that help?

Link to comment
Share on other sites

Not exactly. I need to store x,y/scaleY,scaleY/rotation after moving/scaling/rotation of elements in order to be able perform Undo. For that reason I use FINISH_INTERACTIVE_* events, but I'm not able to get them previous states. SELECTION_CHANGE doesn't allow to save a few same-type actions for selected item.

Link to comment
Share on other sites

Not exactly. I need to store x,y/scaleY,scaleY/rotation after moving/scaling/rotation of elements in order to be able perform Undo. For that reason I use FINISH_INTERACTIVE_* events, but I'm not able to get them previous states. SELECTION_CHANGE doesn't allow to save a few same-type actions for selected item.

 

Be careful about storing x/y/scaleX/scaleY/rotation instead of the transform.matrix a/b/c/d/tx/ty values because matrix values are the only ones that guarantee accuracy (x/y/scaleX/scaleY/rotation cannot accommodate any skewing that can occur with multiple selections).

 

Here's what I envisioned: you record each item's state (the matrix values or whatever you want) initially. You listen for FINISH_INTERACTIVE_* events and do likewise (record the matrix values) in an array and ALSO record the items that were affected by that event in a separate array (for example, when a scale of mc1 and mc2 is finished, it records mc1 and mc2 in that array). Then when you need to undo, you look at that Array and see which items were affected by the last event and get those values from the associated Arrays (look in mc1's array and mc2's array and get the previous matrix values and apply them). See what I mean?

Link to comment
Share on other sites

  • 7 months later...
Not exactly. I need to store x,y/scaleY,scaleY/rotation after moving/scaling/rotation of elements in order to be able perform Undo. For that reason I use FINISH_INTERACTIVE_* events, but I'm not able to get them previous states. SELECTION_CHANGE doesn't allow to save a few same-type actions for selected item.

 

Be careful about storing x/y/scaleX/scaleY/rotation instead of the transform.matrix a/b/c/d/tx/ty values because matrix values are the only ones that guarantee accuracy (x/y/scaleX/scaleY/rotation cannot accommodate any skewing that can occur with multiple selections).

 

Here's what I envisioned: you record each item's state (the matrix values or whatever you want) initially. You listen for FINISH_INTERACTIVE_* events and do likewise (record the matrix values) in an array and ALSO record the items that were affected by that event in a separate array (for example, when a scale of mc1 and mc2 is finished, it records mc1 and mc2 in that array). Then when you need to undo, you look at that Array and see which items were affected by the last event and get those values from the associated Arrays (look in mc1's array and mc2's array and get the previous matrix values and apply them). See what I mean?

 

how to do this,

there is no such Properties or methods

 

would u show me a demo , please

Link to comment
Share on other sites

Sure, all DisplayObjects have a transform.matrix property with those values. However, recent versions of TransformManager have some new methods that make all this much simpler - exportFullXML() and applyFullXML() as well as some other ones that let you do item-specific exporting/applying. See the ASDocs for details: http://www.greensock.com/as/docs/transform/

Link to comment
Share on other sites

Sure, all DisplayObjects have a transform.matrix property with those values. However, recent versions of TransformManager have some new methods that make all this much simpler - exportFullXML() and applyFullXML() as well as some other ones that let you do item-specific exporting/applying. See the ASDocs for details: http://www.greensock.com/as/docs/transform/

 

thank u very much~

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×