Jump to content

How to clear PIXI.Application?


Recommended Posts

I have implemented PIXI application with more containers  like containers inside another container. I am adding PIXI.Texture for video and PIXI.Sprite for Image view. Everything working fine for the first time. Whenever I try playing video again by closing and opening page, I can see blank and throwing Uncaught TypeError: Cannot read property 'updateTransform' of null

 I found somewhere that I need to clear the containers and PIXI.Applications. I am doing like below but could not get it done.

if (this.appRenderer != null || this.appRenderer.stage != null) {
this.mainContainer.children.map((item) =>{ //it contains another container in which video and image functionalities implemented
this.appRenderer = null;
console.log("Component Unmount, Pixi release ",ex.message) //TO-DO
Link to comment
Share on other sites

I initialized like below


init = (glBaseElement) => {
//Create pixi application instance
this.baseElement = glBaseElement;
this.ticker = PIXI.Ticker.shared;
this.ticker.autoStart = false;
this.appRenderer = new PIXI.Application({
width: this.appRendererWidth,
height: this.appRendererHeight
this.imageSlideElementHolder = this.refs[glBaseElement];
this.mainContainer = new PIXI.Container();
Link to comment
Share on other sites

what about the one inside application that is turned on by default? 

You have to read https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop  and either get rid of application in favor of simple renderer, or notice that app has its own destroy: https://github.com/pixijs/pixi.js/blob/dev/packages/app/src/Application.js#L132

Application was created as a helper class for hello-worlds and examples. Yes, we support it in production if people want, but I require from everyone to actually look inside and understand that it's just a mashup, you should get rid of it as soon as you encounter first problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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