> Les erreurs globales tu pourras les intercepter que dans une application
> compilée pour la version 10.1 du FlashPlayer (qui est pour le moment sur le
> Labs de Adobe)


ou avec AIR 2 qui est dispo en Release Candidate sur le lab
http://labs.adobe.com/technologies/air2/

---
Global Error Handling
Global error handling lets you handle all uncaught errors (both
synchronous errors and asynchronous error events) in one place in your
code. See UncaughtErrorEvent.
---

http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/UncaughtErrorEvent.html

copié/collé de l'example
---
package
{
    import flash.display.Sprite;
    import flash.events.ErrorEvent;
    import flash.events.MouseEvent;
    import flash.events.UncaughtErrorEvent;

    public class UncaughtErrorEventExample extends Sprite
    {
        public function UncaughtErrorEventExample()
        {
 
loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR,
uncaughtErrorHandler);

            drawUI();
        }

        private function
uncaughtErrorHandler(event:UncaughtErrorEvent):void
        {
            if (event.error is Error)
            {
                var error:Error = event.error as Error;
                // do something with the error
            }
            else if (event.error is ErrorEvent)
            {
                var errorEvent:ErrorEvent = event.error as ErrorEvent;
                // do something with the error
            }
            else
            {
                // a non-Error, non-ErrorEvent type was thrown and
uncaught
            }
        }

        private function drawUI():void
        {
            var btn:Sprite = new Sprite();
            btn.graphics.clear();
            btn.graphics.beginFill(0xFFCC00);
            btn.graphics.drawRect(0, 0, 100, 50);
            btn.graphics.endFill();
            addChild(btn);
            btn.addEventListener(MouseEvent.CLICK, clickHandler);
        }

        private function clickHandler(event:MouseEvent):void
        {
            throw new Error("Gak!");
        }
    }
}
---

zwetan

-- 
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes FCNG.
Pour envoyer un message à ce groupe, adressez un e-mail à [email protected].
Pour vous désabonner de ce groupe, envoyez un e-mail à l'adresse 
[email protected].
Pour plus d'options, consultez la page de ce groupe : 
http://groups.google.com/group/fcng?hl=fr

Répondre à