Skip to content
This repository has been archived by the owner on Dec 9, 2019. It is now read-only.

mouse events through hidden sprites #3

Open
BonesGit opened this issue Jun 30, 2011 · 0 comments
Open

mouse events through hidden sprites #3

BonesGit opened this issue Jun 30, 2011 · 0 comments

Comments

@BonesGit
Copy link

If you position a hidden circle over a visible circle the event on the visible circle will not get triggered.

    var radius = 20;
    var display = doodle.createDisplay('#display', {width:600, height:600});
    var layer0 = display.createLayer();

    // target circle
    var sprite = doodle.createSprite();
    sprite.graphics.lineStyle(0, 0x000000, 0);
    sprite.graphics.beginFill(0x22ff55);
    sprite.graphics.circle(0, 0, radius);
    sprite.graphics.endFill();
    sprite.x = 200;
    sprite.y = 200;
    layer0.addChild(sprite);

    // flash circle
    var circleFlash = doodle.createSprite();
    circleFlash.graphics.lineStyle(0, 0x000000, 0);
    circleFlash.graphics.beginFill(0xffffff);
    circleFlash.graphics.circle(0, 0, radius * 2);
    circleFlash.graphics.endFill();
    circleFlash.x = sprite.x;
    circleFlash.y = sprite.y;
    circleFlash.visible = false;
    layer0.addChild(circleFlash);


    // sprite click event
    sprite.on(doodle.events.MouseEvent.CLICK, function (event) {
        console.info( 'click');  // will not execute if flash circle is hidden over top of the sprite circle
    });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant