Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Button problem — Gideros Forum

Button problem

rcorreiaptptrcorreiaptpt Member
edited February 2014 in General questions
Hello all i seem to have a problem with making a button i use :

local bg = Bitmap.new(Texture.new("bg.png"))
button = Button.new("start.png","start.png");
button:setPosition(10,10)
stage:addChild(button)
stage:addChild(bg)

and i get an error when i try to run:
attempt to index global 'Button' (a nil value)

I can´t figure out what i´m doing wrong here :X

Comments

  • ar2rsawseenar2rsawseen Maintainer
    edited February 2014 Accepted Answer
    Hello @rcorreiaptpt ;)
    Button is not actually a built in Gideros class, but rather a lua class build upon it, you can download it and include in your project (button.lua) from here:
    https://github.com/gideros/Button

    And the usage is also a bit different.
    You need to provide Bitmap instances like this:
    local bg = Bitmap.new(Texture.new("bg.png"))
     
    local buttonImage = Bitmap.new(Texture.new("start.png"))
    local button = Button.new(buttonImage,buttonImage);
    button:setPosition(10,10)
    stage:addChild(button)
    stage:addChild(bg)
    More info: http://appcodingeasy.com/Gideros-Mobile/Gideros-mobile-button-class

    Hope that helps ;)

    Likes: rcorreiaptpt

    +1 -1 (+1 / -0 )Share on Facebook
  • Thank you very much for taking the time to answer me.It help me a lot :) thanks again.
Sign In or Register to comment.