Вы используете Timer Class в пакете java.util и планируете timertask, чтобы закрыть заставку через некоторое время, скажем, 2 минуты или задача завершена.
final Processing nc = new Processing();
nc.setVisible(true);
Timer timer = new Timer():
TimerTask task = new TimerTask() {
public void run() {
nc.setVisible( false );
// to do disposing nc
}
};
timer.schedule( task, 1000 * 3 ); // dispose the processing frame after 3 minutes
//Declare menu as an instance variable instead of a local var
private var myMenu:Menu;
//var to store menu status
private var isMenuVisible:Boolean
//Create the Menu control. call this from the creationComplete of the
//application or the Component that it is part of.
private function createMenu():void
{
var myMenu:Menu = Menu.createMenu(null, myMenuData, false);
myMenu.labelField="@label";
//menu fires an event when it is hidden; listen to it.
myMenu.addEventListener(MenuEvent.MENU_HIDE, onMenuHidden);
}
private function onMenuHidden(e:MenuEvent):void
{
/*
menuHide event fired whenever the menu or one of its submenus
are hidden - makes sure it was indeed the main menu that was hidden
I don't have compiler handy to test this, so if for
some reason comparing myMenu with e.menu doesn't work,
try if(e.target == myMenu) instead;
And please let me know which one works via comment :)
*/
if(e.menu == myMenu)
isMenuVisible = false;
}
//call this from button's click
private function toggleMenu():void
{
if(isMenuVisible)
myMenu.hide();
else
myMenu.show();
}