Hallo Liste! Ich habe zu Testzwecken in AS2 eine Klasse "DynamicStack" geschrieben um mir die neue Syntax zu verinnerlichen. Nun ist mir beim Testen der Klasse aufgefallen, dass trotz korrekter import-Anweisung der catch-Block bei meiner "EmptyStackException" nicht aufgerufen wird. Kann mir nicht erklären warum?? Hier der Code: -------------------------------------------------------------------------------- Datei: 'EmptyStackException.as' im Verzeichnis '/stack' // Class EmptyStackException class stack.EmptyStackException extends Error { // Constructor function EmptyStackException(){ message = "An 'EmptyStackException' has occured."; name = "EmptyStackException"; } } Datei: 'ListNode.as' im Verzeichnis '/stack' // Class ListNode class stack.ListNode { // Attributes public var element:Object; public var next:ListNode; // Constructor function ListNode(element:Object, next:ListNode){ this.element = element; this.next = next; } } Datei: 'StackInterface.as' im Verzeichnis '/stack' // Interface StackInterface interface stack.StackInterface { // Methods function push(element:Object):Void; function pop():Object // throws EmptyStackException; function isEmpty():Boolean; } Datei: 'DynamicStack.as' im Verzeichnis '/stack' // Import classes import stack.EmptyStackException; import stack.ListNode; import stack.StackInterface; // Class Stack class stack.DynamicStack implements StackInterface { // Attributes private var head:ListNode; // Constructor function DynamicStack() { head = null; } // Methods public function push(element:Object):Void { head = new ListNode(element, head); } public function pop():Object { //throws EmptyStackException if(isEmpty()) throw new EmptyStackException(); var element:Object = head.element; head = head.next; return element; } public function isEmpty():Boolean { return (head == null); } } Datei: 'testStack.fla' im Verzeichnis '/' Frame 1: // Import classes import stack.DynamicStack; import stack.EmptyStackException; // Create Instances var myDynStack:DynamicStack = new DynamicStack(); var hello:String = new String("%"); // Main //myDynStack.push(new String("Hello world!")); try{ hello = String(myDynStack.pop()); } catch(e:EmptyStackException){ // Problemzone, catch-Block wird nicht ausgeführt trace("Error: "+e.message); } trace(hello); -------------------------------------------------------------------------------- Der catch-Block wird halt nur aufgerufen wenn ich für meine Exception auch das Package mitangebe, trotz explizit angegebener import-Anweisung: catch(e:stack.EmptyStackException){ Mache ich da irgendwas falsch? Gruss Martin