Share Posted January 13, 2009 I know that I am just missing something simple here. I can read all of my displayObjects so that I can save them to my data stream. After I move an item, I always get the original position information that was used to place it in the transformManager. So what am I missing?? Link to comment Share on other sites More sharing options...
Share Posted January 13, 2009 Not sure - how are you trying to read the x/y data? TransformManager doesn't do anything fancy that would hide that info. It should be as simple as myObject.x and myObject.y. Are you using it in Flex? There are several bugs in the Flex framework (acknowledged by Adobe) that prevent properties from being updated by matrix transformations, so maybe that's the problem. See if myObject.transform.matrix.tx and myObject.transform.matrix.ty give you the results you're after. Link to comment Share on other sites More sharing options...
Author Share Posted January 13, 2009 I can add the items to the transformManager using the .addItem(object). var oNode:ImageRender = new ImageRender(x, y, w, h, imgUrl); var uiComp:UIComponent = new UIComponent(); uiComp.addChild(oNode); oContainer.addChild(uiComp); After the user interacts w/ the display & moved the node around, then I read the object(s) back out of the container to write their new position to my data stream. // - Loop through the oContainer controls var oaNodes:Array = oContainer.getChildren(); if (oaNodes.length > 0) { // - Loop & process nodes // ***Note***; The pageContainer has UIComponents, which inturn has a single clsItemRender or clsTextRender var oUIComp:UIComponent = null; var oImageRender:ImageRender = null; for (var nIndex:int = 0; nIndex < oaNodes.length; nIndex++) { // - Are we an actual 'UIComponent' ? oUIComp = oaNodes[nIndex] as UIComponent; oImageRender = oUIComp.getChildAt(0) as ImageRender; if (oImageRender != null) { // var myRect2:Rectangle = pageContainer.getBounds(oImageRender); // var myRect2:Rectangle = oUIComp.getBounds(oImageRender); trace(" - oUIComp.transform.matrix.tx = " + oUIComp.transform.matrix.tx.toString()); trace(" - oUIComp.transform.matrix.ty = " + oUIComp.transform.matrix.ty.toString()); trace(" - oImageRender.transform.matrix.tx = " + oImageRender.transform.matrix.tx.toString()); trace(" - oImageRender.transform.matrix.ty = " + oImageRender.transform.matrix.ty.toString()); } } Even when the image node is moved within the transformManager, I always get the inital x/y. The oImageRender.transform.matrix.tx / ty always give me 0/0. Any ideas?? I get values from the oUIComp.tx/ty, but they are not right either, (I could always convert them relative to the oContaine??) Thanks in advance. Link to comment Share on other sites More sharing options...
Share Posted January 13, 2009 What exactly are you adding to the TransformManager? Maybe you're adding the parent of the object that you're trying to get the x/y coordinates of? In that case, TransformManager will make all the changes to the parent which has no effect on the child's properties. Link to comment Share on other sites More sharing options...
Author Share Posted January 13, 2009 I was wondering about that. Since the UIComponent is what is getting added to the transformManager, & the imageRender object is a child of the UICompnent. I will give a try to getting the UIComponent information. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now