`this.__activateRevive` is not a function?

For some reason, I am getting:

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' :

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!

make __initializeWindow an arrow function.

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

@Phailser : I still get :

Uncaught TypeError: this.__activateRevive is not a function

Here is 'gameover-ui.js' :

__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;
 
},

Hello?

Tired of being ignored… :frowning:

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.

Fixed…