Показать сообщение отдельно
Старый 10.04.2008, 15:15
etc вне форума Посмотреть профиль Найти все сообщения от etc
  № 28  
Ответить с цитированием
etc
Et cetera
 
Аватар для etc

Регистрация: Sep 2002
Сообщений: 30,787
Код:
…
    socket.addEventListener(IOErrorEvent.IO_Error, this.handler_ioError);
…
private var _attempts:uint = 0;

private var _timeoutID:uint;

private function connect():void {
    this._attempts++;
    try {
        socket.connect(…);
    } catch (error:Error) {
        this.attempt();
    }
}

private function attempt():void {
    if (this._attempts > 2) {
        // bla-bla, показываем ошибку
        
    } else {
         this.showMessage("Error", "Connection failed", Message.OK);
    }
}

private function handler_ioError(event:IOErrorEvent):void {
    this.attempt();
}

private function handler_okClick(event:Event):void {
    this.hideMessage();
    this.connect();
}
Как-то так. Рекурсии не будет. В чем проблема?