Write an "update sprite" function????

Dear RPG Maker Community,

I would like to write a function which kinda animates sprites by changing their opacity. So I guess I need 2 functions:

Sprite_Test.prototype.createSprite = function() {
var eyes1 = new Sprite(Bitmap.load('img/pictures/File0003.png'));
this.addChild(eyes1); }

and:

Sprite_Test.prototype.updateSprite = function() {
this.eyes1.opacity = 255;
wait(100);
this.eyes1.opacity = 0;
wait(100);
this.eyes1.opacity = 255; }


Like this, the update function doesn't work, always telling me that 'eyes1' is not defined???
And where did you define "eyes"?

The first part only defines " eyes1", not "eyes"...
Ahh, sorry. It's supposed to be eyes1 everywhere. But that's not the problem, I just wrote it wrong in the post.

Original thread: https://forums.rpgmakerweb.com/threads/write-an-update-sprite-function.86251/