Light script not working

I am making a script for a light that is supposed to make the light flash. Although when I tested it It did not work and nothing happened. Can anybody help?

// initialize code called once per entity
LightFlash.prototype.initialize = function() {


//Define Flash
LightFlash.prototype.Flash = function() {
    this.entity.enabled = false;
    window.setTimeout( function(){
    this.entity.enabled = true;
    }.bind(this), 1000);

// update code called every frame
LightFlash.prototype.update = function(dt) {

// swap method called for script hot-reloading
// inherit your script state here
// LightFlash.prototype.swap = function(old) { };

// to learn more about script anatomy, please read:

Hi @PhilipJeffrey!

You can’t use a timeout inside the update function and that’s what you basically do right now. Please check your topic below, I think you can use that here too.

Hmm? I don’t quite understand what you mean. Can you give me an example?

Remove this.Flash(); from the update function and place it in the initialize function and the timeout.