Good day everyone,
I'm working with ExtJS 4.1 and I'm trying to write a code to automatically hide an alert message box after a certain time duration.
I typed following code:

Ext.Msg.alert('Error', 'form is not valid');
function hide_message()
{
Ext.MessageBox.hide().defer(5000);
}
hide_message();


but it doesn't work and it raises the following exception:

Uncaught TypeError: Cannot call method 'defer' of undefined

What's the matter with that code, and how can I modify it to reach my goal?

Thanks in advance guys.