Skip to content

Commit b7aefb1

Browse files
committed
Toast: when adding a new toast, move the container to the top
This prevents toasts after the first one from appearing behind other pop-ups
1 parent 68717a9 commit b7aefb1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/feathers/controls/Toast.as

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,14 @@ package feathers.controls
688688
{
689689
if(starling in Toast._containers)
690690
{
691-
return DisplayObjectContainer(Toast._containers[starling]);
691+
var container:DisplayObjectContainer = DisplayObjectContainer(Toast._containers[starling]);
692+
// always move it to the top, so that new toasts don't appear
693+
// behind other pop-ups added after the first toast
694+
container.parent.setChildIndex(container, container.parent.numChildren - 1);
695+
return container;
692696
}
693697
var factory:Function = Toast._containerFactory !== null ? Toast._containerFactory : defaultContainerFactory;
694-
var container:DisplayObjectContainer = DisplayObjectContainer(factory());
698+
container = DisplayObjectContainer(factory());
695699
Toast._containers[starling] = container;
696700
container.addEventListener(Event.REMOVED_FROM_STAGE, function(event:Event):void
697701
{

0 commit comments

Comments
 (0)