Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
button animation — Gideros Forum

button animation

HanigranHanigran Member
edited July 2014 in General questions
I'm trying to view animation after click the button but i'm doing something wrong


exit = Bitmap.new(Texture.new("5.png"), true)
exit:setPosition(250, 200)
stage:addChild(exit)
local frames = {}
frames[1] = Bitmap.new(Texture.new("komiks1.png"))
frames[2] = Bitmap.new(Texture.new("komiks2.png"))

local mc1 = MovieClip.new{
{1, 10, frames[1]},
{10, 20, frames[2]},

}
mc1:setPosition(0,0)
stage:addChild(mc1)
mc1:setGotoAction(0,0)
mc1:gotoAndPlay(1)
local frames = 0
exit:addEventListener("click",
function()
click= frames+1


end)

Comments

  • yubaroyubaro Member
    @Hanigran, you need to include the Button class:
    https://github.com/gideros/Button

    Try:
    local buttonUp = Bitmap.new(Texture.new("5.png"), true)
    local buttonDown = Bitmap.new(Texture.new("5.png"), true)
    local button = Button.new(buttonUp, buttonDown)
    button:setPosition(50,50)
    stage:addChild(button) 
     
    local frames = {}
    frames[1] = Bitmap.new(Texture.new("komiks1.png"))
    frames[2] = Bitmap.new(Texture.new("komiks2.png"))
     
    local mc1 = MovieClip.new{
    {1, 10, frames[1]}, 
    {10, 20, frames[2]}, 
     
    }
    mc1:setPosition(50,50)
    stage:addChild(mc1)	
     
    button:addEventListener("click", 
    	function()
    		print("Started button")	
    		mc1:gotoAndPlay(1)	
    		mc1:setGotoAction(20,1)	
    	end
    )
Sign In or Register to comment.