Jump to content

touchmove not being called until after touching another sprite


rroylance
 Share

Recommended Posts

I have an object that contains a Sprite and I set that sprite to be interactive and set all the interaction callbacks however when I add a few of them to my scene I must touch the last added one before the other's will send the touchmove event (touchstart, and touched are still being called).

 

The mouse events are called fine when played in a browser, this issue arises when I play on my iOS devices.

 

MySprite 

NameSpace.MySprite = function(){    this.selected = this.selected.bind(this);    this.dragged = this.dragged.bind(this);    this.deselected = this.deselected.bind(this);    this.sprite = PIXI.Sprite.fromFrame("sprite01.png");    this.sprite.interactive = true;    this.sprite.mousedown = this.sprite.touchstart = this.selected;    this.sprite.mousemove = this.sprite.touchmove = this.dragged;    this.sprite.mouseup = this.sprite.mouseupoutside = this.sprite.touchendoutside = this.sprite.touchend = this.deselected;}NameSpace.MySprite.prototype.constructor = NameSpace.MySprite;NameSpace.MySprite.prototype.selected = function(data){    this.data = data;    this.dragging = true;};NameSpace.MySprite.prototype.dragged = function(){    if(this.dragging)    {        this.destinationX = this.data.getLocalPosition(this.container).x;    }};NameSpace.MySprite.prototype.deselected = function(){    this.destinationX = this.sprite.position.x;    this.dragging = false;    this.data = null;};

Create MySprites

this.sprites = [];var sprite = null;for(var i = 0, spriteCount = 5; i < spriteCount; i++){    sprite = new NameSpace.MySprite();    this.sprites.push(sprite);}
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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