This content has been marked as final. Show 7 replies
Here's an idea..
Say your container is centered horizontally and vertically. See if you can get the width of the stage, which would be the whole application, then use that along with the container width to get the x.
var xpos:int = (this.width - myContainer.width)/2;
Have you tried searching the help docs?
That will help, but it still won't tell me the positioning of components within that container. For example, I have three components vertically layed out and I want to know the x,y of the top left of the third component.
I've searched the docs but haven't been able to find the answer yet. I'm very close to finishing my project with Flex I've just got a few hurdles like this one slowing me down.
You can probably use what I posted above to get the x for that 3rd component.. but the y would have to be different.. it would be based on the height of the components above it right? This sounds right to me..
Well, that is based on the premise that I know how components are laid out in layout manager.
Is there no function in ActionScript to find the absolute position of the UIComponent....I can't imagine that's there's not....or at least some way to access the underlying flash aspect to find out where the information is being placed in the page.
How about using the localToGlobal method?
I've tried that and I pass it new Point(0, 0) and it always returns 0, 0. I've tried accessing myUIComponent.stage, but it's null.
Let me change my answer here...that actually does work, but only after initialization. :o
Thanks, I'll give this a try and see if it does what I need.