You are confusing Components and Elements. The afterrender
event listener is set on the Image Component, and receives the Component itself as the first argument (that you named el
instead, incorrectly).
Then, in the afterrender
listener, you retrieve the main DOM element for that Component, which happens to be an <img>
tag, and set click
listener on the element object, which is an instance of Ext.dom.Element
.
The click
event signature is not what you expect; the first argument is an Ext.util.Event
object that does not have a fireEvent
method. Hence the error.
I would suggest looking up event signatures in the docs before using them. Also try to add a debugger
statement before the line that blows up, and see what variables are passed in and what is going on. Using Chrome or Firefox debugger can be immensely helpful here.