Question

I have a sprite as a button on the scene and i integrate AnalogScreenController,

I have actions onSceneTouch, onAreaTouch(Sprite mySprite) and onAnalogScreenControllerTouch.

When i press on the analogScrennController everything is ok, but when i try to touch the Sprite both onSceneAreaTouch and onAreaTouch(Sprite mySprite) is performed, but i want to disable sceneTouch when i press on my sprite (like in onAnalogScreenController). I want to hide sprite when i press on the scene, but if i do so i can't press on my sprite, because if i try to touch it it dissapear before perform onAreTouch acntion.

Was it helpful?

Solution

I mean than when i touch my sprite i don't want to onSceneTouch actions to perform.

wrong code:

    mySprite = new Sprite(...){

    @Override
    boolean onAreaTouch(...){
    if (isActionUp){
    ...
    }
    return false;
    }

right code:

wrong code:

    mySprite = new Sprite(...){

    @Override
    boolean onAreaTouch(...){
    ...
    return true;
    }

In second version when i touch mySprite onSceneTouch() is no performed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top