Sign in to follow this  

Childs Ticker Listener

Recommended Posts


I have a PIXI app with many child (in a tree structure). I need to update only child that contains the method "update". There is any logic inside PIXI for this or I would need to add each of those object in the shared.ticker? 

I did this, but there could be a better way that could allow me to remove the ticker listener if I need to. THIS IS NOT FOR SPRITE ANIMATIONS, it's mostly to change objects position



Share this post

Link to post
Share on other sites


Im not liking to do so many hack but I don't see other way to do it without waiting for new releases. 

Please give me you opinion on this, would this fail in any scenario?


PIXI.Container.prototype.onChildrenChange = function(childIndex){  
  let child = this.children[childIndex]
  console.log(childIndex, this.children)
  if(this.children.length > 0 && child.hasCustomEvents != true){
    child.hasCustomEvents = true

	//Define here any custom event
    let customEvents = ['update','render']

    for(let i=0;i<customEvents.length;i++){
      let eventName = customEvents[i]
      if(typeof child[eventName] == 'function'){
          console.log('LISTENER ADDED',eventName, child[eventName])
          console.log('LISTENER REMOVED',eventName, child[eventName])



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.