Jump to content

[PIXI v3] Interactive Sprite below a TilingSprite Problem


fsrojas
 Share

Recommended Posts

Hello,

 

Let's say that i have an "Interactive" Sprite Button (sprite.interactive = true) ready for receiving click/touch events, and above of it there is a big TilingSprite (with the size of all screen) to create a Flash effect.

 

The tiling sprite is visible (tilingSprite.visible = true) and its alpha oscillate between 0.1 to 0.5. The problem is when i want to touch/click the Sprite button nothing happens... The only way to receive a touch/click event is by setting tilingSprite.visible = false.

 

Is there any way to set the interaction manager to "bypass" some elements like some TilingSprites or others?

Link to comment
Share on other sites

var button = PIXI.Sprite.fromFrame("button.png");

button.anchor.x = 0.5;

button.anchor.y = 0.5;

button.position.x = defaultWidth*0.5;

button.position.y = defaultHeight*0.5;

button.interactive = button.buttonMode = true;

button.on("mousedown",button.mousedown);

button.mousedown = function(eventData)

{

//Button event

alert('mousedown!');

}

stage.addChild( button );

var textureWhite = PIXI.Texture.fromImage("white.png");

var tilingWhite = new PIXI.extras.TilingSprite(textureWhite, defaultWidth, defaultHeight);

tilingWhite.alpha = 0.2;

tilingWhite.position.x = 0;

tilingWhite.position.y = 0;

stage.addChild (tilingWhite);

//tilingWhite.visible = false;

Link to comment
Share on other sites

  • 3 months later...

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