Hello,
I'm working on some project where I have a big container Sprite and based on
what I need, I add some ui inside of it. Once I add this ui, and I make sure
that everything is there on its place, I align this container sprite to fir
in the center of my stage:
private var currentModule:Sprite; // the container
private function updateScreen(e:MouseEvent):void {
if(currentModule) { // when I switch to another module
removeChild(currentModule);
currentModule = null; // clean it up
}
currentModule = new Sprite();
addChild(currentModule);
currentModule.addChild(children); //some children are added to currentModule
currentModule.x = (stage.stageWidth * 0.5) - (currentModule.width *0.5) //
aligns horizontally
currentModule.y = (stage.stageHeight * 0.5) - (currentModule.height *0.5) //
aligns horizontally
}
Now assume I add to the currentModule, a masked list. What I mean is a
container that contains 100 list items one below the other, and a mask that
shows just 5 items and the mask's height is 100.
stage alignment doesn't work properly because the currentModule height is
not just 100 px (as the mask's height) but it is actually the real height
that the 100 list item are occupying and so, alignment fails.
I could use myMask.height, but I need to align the whole currentModule as I
use it as a wrapper to wrap some components under the same hood.
What should I do? I tried tracing the mc's height after using scrollRect, as
people said that it would return only the visible part's height but it
didn't happen. I traced and the same number is there as if nothing were
masked.
Any Ideas?
Thanks in advance
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders