To answer your first question, the scrollRect property "masks" the display object. This property is assigned in the scrollChildren() of the Container class.
* Positions the container's content area relative to the viewable area
* based on the horizontalScrollPosition and verticalScrollPosition properties.
* Content that doesn't appear in the viewable area gets clipped.
* This method should be overridden by subclasses that have scrollable
* chrome in the content area.
protected function scrollChildren():void
contentPane.scrollRect = new Rectangle(x, y, w, h);
I believe the answer to your second question would be that, Container.validateDisplayList() calls createContentPaneAndScrollbarsIfNeeded() in a conditional and if that returns true, then it will call super.validateDisplayList(). So the contentPane seems to be created *during* validateDisplayList(), if its needed.
override public function validateDisplayList():void
// Based on the positions of the children, determine
// whether a clip mask and scrollbars are needed.
// Redo layout if scrollbars just got created or destroyed (because
// now we may have more or less space).
if (_autoLayout || forceLayout)
doingLayout = true;
doingLayout = false;
// If a scrollbar was created, that may precipitate the need
// for a second scrollbar, so run it a second time.
Hey thanks for the answers.
I didn't know about the scrollRect property. That's a useful one
For my second question sorry but I dont think it's what really happening. You see the first validateDisplayList() before calling createContentPaneAndScrollbarsIfNeeded() ? That one goes to UIComponent.validateDisplayList() where a first call to updateDisplayList is done. That's why it's reaching my custom update function before creating the contentPane.
But what about the second call to super.validateDisplayList() after a true createContentPaneAndScrollbarsIfNeeded() ? Well too bad for me this function is returning true if scrollbars have been created. Not just a contentPane ! And guess what ? I'm not using scrollbars
So what trick do you think i might to have my contentPane initialized in my update function. Maybe sould I call my update a second time or something...