How to add an InputMask plugin, and a mask, in a textfield dynamically, via JS?

I already tried:

var pl = Ext.PluginManager.create({ ptype: 'inputmask', proxyId: campo.name, mask: result });

textfield.addPlugins(pl);
but didn't work.

textfield is a TextField created in code behind.

The error happens in parseNamespace function because the first argument is undefined.