The method "getObject()" is deprecated since version 3.1, thus imgObj is undefined because mx.processor.getObject() is (evaluates to) undefined.
I usually reference the apidocs link above or this forum as resources.
Also refer to the widget tutorial if you have not already: Widgets - Quick Start
Seems your attribute setting is correct (although it's bad practice to hard-code attribute names, you can easily make these configurable). I sugegst replacing setAttribute with the new set(attr, val) for 3.0. You can find all the methods that a Mendix object in the client has here.
You seem to be lacking the object. I'd advise you look at the Quick start that Marlo linked first. Especially this part is good to start with Widget base. These attributes and methods can be used in every widget you make. The startup and update methods are placeholders you can overwrite to start your widget.
I'm assuming you already have a postCreate (the pre-3.0 version) or startup call. This is used to start your widget. You can either start your widget from here, or you can wait for the update() to be called if you require an actual object to work with (make sure to always call the callback at the end).
Side note: the mx.processor.getObject uses multiple arguments and is deprecated since 3.0. You can now retrieve your own objects using mx.processor.get().