Last active
August 29, 2015 14:01
-
-
Save jskuse/c022105d593bd9999c53 to your computer and use it in GitHub Desktop.
Get the registration point for an element on the Flash stage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRegistrationPoint(element) { | |
var t = element.matrix; | |
if (t.b == 0 && t.c == 0) { | |
return { x: (element.x - element.left) / t.a, y: (element.y - element.top) / t.d }; | |
} | |
var doc = fl.getDocumentDOM(); | |
var previousSelection = doc.selection; | |
doc.selection = [element]; | |
doc.enterEditMode(); | |
var reg = getRegistrationPoint(doc.selection[0]); | |
doc.exitEditMode(); | |
doc.selection = previousSelection; | |
return reg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment