# \`this.\_\_activateRevive\` is not a function?

**URL:** <https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192>\
**Category:** Phaser 3\
**Created:** [May 4, 2020, 6:11pm UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192 "2020-05-04T18:11:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thundros](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thundros/32/2057_2.png) [@Thundros](https://phaser.discourse.group/u/Thundros)\
**Post date:** [May 4, 2020, 6:11pm UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/1 "2020-05-04T18:11:17Z")

</div>

For some reason, I am getting:

```javascript
Uncaught TypeError:
this.__activateRevive is not a function

```

even though I have already added it to class file as a function ?

Here is my `'GameOverScene.js'` :

```javascript
var GameoverWindow = new Phaser.Class
 
({
 
    Extends : Phaser.Scene,
 
    initialize :
 
    function GameoverWindow ( ) {
 
        Phaser.Scene.call ( this, {
 
            key : 'GameoverWindow',
            active : false,
 
        } );
 
    },
 
    __animComplete : function (__scene, __camera,__ entity, __time ) {
 
        // Create Object Layer{s}
 
        this.GameData = new GameData ( );
 
        __time.delayedCall (
            1000, function ( __anim,__ scene ) {
                // Transition to `move` state
                __stateMachine.transition ( 'move' );
                __entity.setVelocityX (__PLAYER_MAX_MOVESPEED );
                __time.delayedCall (
                    3000, function ( __anim,__ scene ) {
                        GameData.stopCameraFollow ( {
                            camera : __camera,
                            entity : __entity,
                        }, 1 );
                        __time.delayedCall (
                            3000, function ( __anim,__ scene ) {
                                __scene.scene.start ( 'TitleScene', { previousScene: 'TitleScene' } );
                            }, [GetAnimName ( __entity ),__scene]
                        );
                    }, [GetAnimName ( __entity ),__scene]
                );
            }, [GetAnimName ( __entity ),__scene]
        );
 
    },
 
    __activateRevive : function (__objData ) {
 
        __animAction =__ objData.animAction;
        __scene =__ objData.scene;
        __camera =__ objData.camera;
        __entity =__ objData.entity;
        __time =__ objData.time;
 
        __stateMachine.transition (__animAction );
 
        __entity.on ( 'animationcomplete-' +__animAction, function ( ) {
            __animComplete (__scene, __camera,__ entity, __time );
        } );
 
    },
 
    __initializeWindow : function (__objData ) {
 
        __scene =__ objData.scene;
        __camera =__ objData.camera;
        __entity =__ objData.entity;
        __time =__ objData.time;
        __status =__ objData.status;
 
        if ( typeof ( $ ) !== null ) {
 
            $ ( '<div></div>' ).appendTo ( 'body' )
 
            .html ( '<div><h6>Would you like to try again?</h6></div>' )
 
            .dialog ({
 
                modal : true, title : 'Play Again?', zIndex : 10000,
                autoOpen : true, width : 300, height : 250, resizable : false,
                show : 'fade', hide : 'fade',
 
                buttons : {
 
                    Yes : function ( ) {
 
                        $ ( this ).dialog ( 'close' );
 
                        this.__activateRevive ({
                            animAction : 'revive',
                            scene : __scene,
                            camera : __camera,
                            entity : __entity,
                            time : __time,
                        });
 
                    },
 
                    No : function ( ) {
 
                        $ ( this ).dialog ( 'close' );
 
                        $ ( '<div></div>' ).appendTo ( 'body' )
 
                        .html ( '<div><h6>Are you sure?</h6></div>' )
 
                        .dialog ({
 
                            modal : true, title : 'Play Again?', zIndex : 10000,
                            autoOpen : true, width : 300, height : 250, resizable : false,
                            show : 'fade', hide : 'fade',
 
                            buttons : {
 
                                Yes : function ( ) {
 
                                    $ ( this ).remove ( );
                                   
                                },
 
                                No : function ( ) {
 
                                    $ ( this ).dialog ( 'close' );
 
                                    __stateMachine.transition ( 'death' );
 
                                },
 
                            },
 
                            close : function ( event, ui ) {
 
                                $ ( this ).remove ( );
 
                            }
 
                        });
 
                    },
                   
                },
 
                close : function ( event, ui ) {
 
                    $ ( this ).remove ( );
 
                }
 
            });
 
        }
 
        else {
 
            alert ( 'Please install JQuery & JQuery UI & try again!' );
 
            return;
 
        }
 
    },
 
    init : function ( data ) {
 
        console.log ( 'init', data );
        this.finalScore = data.score;
 
    },
 
});

```

Any help as always, is GREATLY appreciated!

Thank You!

---

<div class="post-metadata">

**Author:** ![Phailser](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/phailser/32/3187_2.png) [@Phailser](https://phaser.discourse.group/u/Phailser)\
**Post date:** [May 5, 2020, 12:00am UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/2 "2020-05-05T00:00:28Z")

</div>

make \_\_initializeWindow an arrow function.

Also do the same for your Yes : function ( ) and no: function ( )

---

<div class="post-metadata">

**Author:** ![Thundros](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thundros/32/2057_2.png) [@Thundros](https://phaser.discourse.group/u/Thundros)\
**Post date:** [May 5, 2020, 2:27am UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/3 "2020-05-05T02:27:46Z")

</div>

@Phailser : I still get :

```javascript
Uncaught TypeError: this.__activateRevive is not a function

```

---

<div class="post-metadata">

**Author:** ![Thundros](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thundros/32/2057_2.png) [@Thundros](https://phaser.discourse.group/u/Thundros)\
**Post date:** [May 5, 2020, 5:01am UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/4 "2020-05-05T05:01:06Z")

</div>

Here is `'gameover-ui.js'` :

```javascript
__initializeWindow : (__objData ) => {
 
    __scene =__ objData.scene;
    __camera =__ objData.camera;
    __entity =__ objData.entity;
    __time =__ objData.time;
    __status =__ objData.status;
 
    if ( typeof ( $ ) !== null ) {
 
        $ ( '<div></div>' ).appendTo ( 'body' )
 
        .html ( '<div><h6>Would you like to try again?</h6></div>' )
 
        .dialog ({
 
            modal : true, title : 'Play Again?', zIndex : 10000,
            autoOpen : true, width : 300, height : 250, resizable : false,
            show : 'fade', hide : 'fade',
 
            buttons : {
 
                Yes : ( ) => {
 
                    // $ ( this ).dialog ( 'close' );
 
                    this.__activateRevive ( {
                        animAction : 'revive',
                        scene : __scene,
                        camera : __camera,
                        entity : __entity,
                        time : __time,
                    }, __debug );
 
                },
 
                No : ( ) => {
 
                    $ ( this ).dialog ( 'close' );
 
                    $ ( '<div></div>' ).appendTo ( 'body' )
 
                    .html ( '<div><h6>Are you sure?</h6></div>' )
 
                    .dialog ({
 
                        modal : true, title : 'Play Again?', zIndex : 10000,
                        autoOpen : true, width : 300, height : 250, resizable : false,
                        show : 'fade', hide : 'fade',
 
                        buttons : {
 
                            Yes : ( ) => {
 
                                $ ( this ).remove ( );
                               
                            },
 
                            No : ( ) => {
 
                                $ ( this ).dialog ( 'close' );
 
                                __stateMachine.transition ( 'death',__debug );
 
                            },
 
                        },
 
                        close : ( event, ui ) => {
 
                            $ ( this ).remove ( );
 
                        }
 
                    });
 
                },
               
            },
 
            close : ( event, ui ) => {
 
                $ ( this ).remove ( );
 
            }
 
        });
 
    }
 
    else {
 
        alert ( 'Please install JQuery & JQuery UI & try again!' );
 
        return;
 
    }
 
},
 
init : function ( data ) {
 
    console.log ( 'init', data );
    this.finalScore = data.score;
 
},

```

---

<div class="post-metadata">

**Author:** ![Thundros](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thundros/32/2057_2.png) [@Thundros](https://phaser.discourse.group/u/Thundros)\
**Post date:** [May 5, 2020, 1:52pm UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/5 "2020-05-05T13:52:55Z")

</div>

Hello?

Tired of being ignored… ☹

---

<div class="post-metadata">

**Author:** ![BlunT76](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/blunt76/32/1454_2.png) [@BlunT76](https://phaser.discourse.group/u/BlunT76)\
**Post date:** [May 5, 2020, 2:16pm UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/6 "2020-05-05T14:16:56Z")

</div>

Hi,  
I don’t think you are ignored, just nobody have a solution for you…  
Your syntax is a bit special if we compare it to phaser examples, and you mix dom elements with phaser code…personnaly i’m unable to help you…sorry.

---

<div class="post-metadata">

**Author:** ![Thundros](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thundros/32/2057_2.png) [@Thundros](https://phaser.discourse.group/u/Thundros)\
**Post date:** [May 5, 2020, 4:46pm UTC](https://phaser.discourse.group/t/this-activaterevive-is-not-a-function/6192/8 "2020-05-05T16:46:20Z")

</div>

Fixed…
