you could try positioning it before you add the 'list' to the displayList of the container.
Ktu; On Thu, Jul 8, 2010 at 12:49 PM, Omar Fouad <omarfouad....@gmail.com> wrote: > 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 > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders