Skip to content

Commit

Permalink
ScrollContainer: MXML content is added during initialize(). better de…
Browse files Browse the repository at this point in the history
…tection of when the MXML content is changed. (references #186)
  • Loading branch information
joshtynjala committed Oct 30, 2012
1 parent 7e3c151 commit 458846f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions source/feathers/controls/ScrollContainer.as
Expand Up @@ -264,6 +264,11 @@ package feathers.controls
return this._verticalPageIndex;
}

/**
* @private
*/
protected var _mxmlContentIsReady:Boolean = false;

/**
* @private
*/
Expand All @@ -287,14 +292,15 @@ package feathers.controls
{
return;
}
if(this._mxmlContent)
if(this._mxmlContent && this._mxmlContentIsReady)
{
for each(var child:IFeathersControl in this._mxmlContent)
{
this.removeChild(DisplayObject(child));
this.removeChild(DisplayObject(child), true);
}
}
this._mxmlContent = value;
this._mxmlContentIsReady = false;
this.invalidate(INVALIDATION_FLAG_MXML_CONTENT);
}

Expand Down Expand Up @@ -664,6 +670,8 @@ package feathers.controls
//bypass our overridden addChildAt()
super.addChildAt(this.scroller, super.numChildren);
}

this.refreshMXMLContent();
}

/**
Expand Down Expand Up @@ -829,7 +837,7 @@ package feathers.controls
*/
protected function refreshMXMLContent():void
{
if(!this._mxmlContent)
if(!this._mxmlContent || this._mxmlContentIsReady)
{
return;
}
Expand All @@ -839,6 +847,7 @@ package feathers.controls
var child:DisplayObject = DisplayObject(this._mxmlContent[i]);
this.addChild(child);
}
this._mxmlContentIsReady = true;
}

/**
Expand Down

0 comments on commit 458846f

Please sign in to comment.