You should possibly roll your own class which is the list + mask that reports it's height and width as that of the mask.

Alternatively, if you are feeling lazy, make the mask a symbol & give it an instance name in the IDE, or do it programmatically and access the width / height of that in your calculations, e.g.

currentModule.x = (stage.stageWidth * 0.5) - (currentModule.myMask.width *0.5)



Omar Fouad wrote:
No one?

On Thu, Jul 8, 2010 at 10:34 AM, Omar Fouad <[email protected]> wrote:

Thanks for the reply. I'm already doing that, as the list loads its data
upon added to stage....


On Thu, Jul 8, 2010 at 8:25 PM, Ktu <[email protected]>wrote:

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 <[email protected]>
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to