Jump to content

destroy video


defiraid
 Share

Recommended Posts

Hi, i  can't remove the video with video.destroy. 

It stop it but, it stay on screen.

window.onload = function() {
	var game = new Phaser.Game(674, 520, Phaser.AUTO, '', {
		preload : preload
	});
        var aide2;
	function preload() {
		game.load.onLoadComplete.add(create, this);
		game.load.atlasJSONArray('closeAide', 'assets/images/closeAide.png','assets/images/closeAide.json');
		game.load.video('aide','assets/video/wormhole.mp4');
	}
	function create() {
		aide = game.add.video('aide');
		aide.play(true);
		aide.addToWorld();
		closeAide = game.add.button(20, 20, 'closeAide',clicCloseAide);
	}	
	function clicCloseAide() {
		aide.destroy();
		closeAide.destroy();
	}
}

the video is available here :  https://phaser.io/examples/v2/video/play-video

thanks for your help

closeAide.png

Link to comment
Share on other sites

var aide, aideImg;

function create() {
    aide = game.add.video('aide');
    aide.play(true);
    aideImg = aide.addToWorld();
    closeAide = game.add.button(20, 20, 'closeAide',clicCloseAide);
  } 
  
function clicCloseAide() {
    aideImg.destroy();
    aide.destroy();
    closeAide.destroy();
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...