I have seen this example from the Adobe :
Here in this case Assume that an Exception is thrown inside the validate Method and it is caught in the catch Block .
public function SimpleError()
var errorMessage:TextField = new TextField();
errorMessage.autoSize = TextFieldAutoSize.LEFT;
errorMessage.textColor = 0xFF0000;
errorMessage.text = error.message;
Now can anybody please let me know to what container this TextFiled is added , and how this catch block can access that Container ??
Please help me in understanding this .
That code looks like it was written in a Component or the main Application. The addChild() method will add the TextField to the main app.
The code also looks like it is from an ActionScript only project, but will work the same in a Flex App (use a Label component instead).
The catch block is not special, the scope has access to it's containing class, which in this case is a DisplayObjectContainer at the least.