java - Image button is not functioning anymore after click outside it's area - libgdx - scene2d -


i'm trying build menu screen using scene2d. screen have image background, image button , dialog shows highest score. i've managed make scaling fit different screen size, play button works if first touch or click on otherwise become invisible touching or clicking after first click or touch screen. i'm grate full if show me problem :p.

here main part code

private table buildcontrolslayer(){     table layer = new table();     layer.center();     dialog dialog = new dialog("highsocre: " + highscore, skinsea);     dialog.setcolor(0, 0, 0, 1);     dialog.setorigin(align.center);     dialog.setscale(1.5f);     layer.add(dialog).padbottom(100);     layer.row();     btnplay = new button(skinsea, "play");     layer.add(btnplay);     btnplay.addlistener(new changelistener() {         @override         public void changed(changeevent event, actor actor) {             onplayclicked();         }     });     layer.setfillparent(true);     return layer; }  private void rebuildstage(){     atlas = new textureatlas(constants.texture_atlas_ui);     skinsea = new skin(gdx.files.internal(constants.skin_sea_ui), atlas);      imgbackground = new image(skinsea, "background");     imgbackground.setfillparent(true);     layercontrol = buildcontrolslayer();      stage.clear();     stage.addactor(imgbackground);     stage.addactor(layercontrol);     stage.setdebugall(true); }  @override public void show() {     stage = new stage(new extendviewport(constants.viewport_width, constants.viewport_height));     gdx.input.setinputprocessor(stage);     rebuildstage();     this.resize(gdx.graphics.getwidth(), gdx.graphics.getheight());     gdx.input.setcatchbackkey(true); }  @override public void resize(int w, int h) {     stage.getviewport().update(w, h, false);     imgbackground.setsize(w, h); }  @override public void render(float deltatime){     gdx.gl.glclearcolor(1, 1, 1, 1);     gdx.gl.glclear(gl20.gl_color_buffer_bit);      stage.act(deltatime);     stage.draw(); } 

btw, created table contain background image, set table's size size of screen , had setfillparent(true), background not in right position. tried set table position, not setfillparent(true) , tried set it's size right size, background image not in right position or have bad scale. managed fix not add image table add directly stage. pls show me way use table contain background image if know how to.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -