# \`\_\_scene\` : undefined?

**URL:** <https://phaser.discourse.group/t/scene-undefined/6181>\
**Category:** Phaser 3\
**Created:** [May 3, 2020, 6:28pm UTC](https://phaser.discourse.group/t/scene-undefined/6181 "2020-05-03T18:28:54Z")\
**Posts on this page:** 2\
**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 3, 2020, 6:28pm UTC](https://phaser.discourse.group/t/scene-undefined/6181/1 "2020-05-03T18:28:54Z")

</div>

So why when I try to grab ‘\_\_scene’ in ‘\_\_time.delayedCall ( )’, it is undefined, but right above it before that call when I call ‘console.log ( \_\_scene );’, is the ‘\_\_scene’ NOT undefined?

```javascript
var __animComplete = function (__scene, __camera,__ entity, __time ) {

	console.log ( __scene );

	// Wait { x } millisecond{s} then call `callback` function
	__time.delayedCall ( 1000, function (__anim, __scene ) {

		console.log ( __scene );

		// Transition to `idle` state if needed
		__stateMachine.transition ( 'move' );

	}, [GetAnimName ( __entity )], this );

	// Wait { x } millisecond{s} then call `callback` function
	__time.delayedCall ( 3000, function (__anim, __scene ) {

		console.log ( __scene );

		__entity.setVelocityX (__PLAYER_MAX_MOVESPEED );

		// Wait { x } millisecond{s} then call `callback` function
		__time.delayedCall ( 1000, function (__anim, __scene ) {
			console.log ( ' __anim :: ' +__ anim );
			console.log ( ' __scene :: ' +__ scene );
			__scene.stop ( );
		}, [GetAnimName ( __entity )], this );

	}, [GetAnimName ( __entity )], this );

}

this.__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' );

					__stateMachine.transition ( 'revive' );

					__entity.on ( 'animationcomplete-revive', function ( ) {
						__animComplete (__scene, __camera,__ entity, __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;

	}

}

if ( __m.GetAnimName (__entity ) === 'death' ) {

	__time.delayedCall ( 3000, function ( ) {
		if ( __m.GetAnimName (__entity ) === 'death' && __status === 2 ) {
			__status = 0;
			gameOverUI.__initializeWindow ({
				status : __status, 
				scene : __scene, 
				camera : __camera, 
				entity : __entity, 
				time : __time, 
			});
		}
	}, [__m.GetAnimName (__entity, __debug )], this );

}

```

Any help as always is GREATLY appreciated!

Thank You! \<3

---

<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 3, 2020, 8:28pm UTC](https://phaser.discourse.group/t/scene-undefined/6181/2 "2020-05-03T20:28:34Z")

</div>

Can you just use an arrow function and omit \_\_scene:  
`__time.delayedCall ( 1000, (__anim ) => {`
