void CheckPopups()
{
_justClosedPopups.Clear();
if (_popupStack.Count > 0)
{
DisplayObject mc = Stage.inst.touchTarget as DisplayObject;
bool handled = false;
while (mc != Stage.inst && mc != null)
{
if (mc.gOwner != null)
{
int k = _popupStack.IndexOf(mc.gOwner);
if (k != -1)
{
for (int i = _popupStack.Count - 1; i > k; i--)
{
int last = _popupStack.Count - 1;
GObject popup = _popupStack[last];
ClosePopup(popup);
_justClosedPopups.Add(popup);
_popupStack.RemoveAt(last);
}
handled = true;
break;
}
}
mc = mc.parent;
}
if (!handled)
{
for (int i = _popupStack.Count - 1; i >= 0; i--)
{
GObject popup = _popupStack[i];
ClosePopup(popup);
_justClosedPopups.Add(popup);
}
_popupStack.Clear();
}
}
}