Help Button

Hello, I need to move the buttons to disappear from the main view, from a local function I can not access, when I call is nil for the button, the only way is a global function, any suggestions or right to do so ?, thank you.

Hello my friend, try using http://docs.coronalabs.com/api/type/EventListener/dispatchEvent.html,

and if event.name = X  you call remove:Self in desired function.

Cheers

thank you, friend, but what I need is to access the button to move it out of view and from a local function can not access. 

some solution?

Please post some samples of your code, will help you with it.

local widget = require( “widget” )

– Function to handle button events

local function handleButtonEvent( event )

    if ( “ended” == event.phase ) then

        print( “Button was pressed and released” )

        transition.to(button1 , {time = 1000, x = 0})

        transition.to(button2 , {time = 1000, x = 0})

    end

end

– Create the widget

local button1 = widget.newButton

{

    left = 50,

    top = 200,

    id = “button1”,

    label = “button1”,

    onEvent = handleButtonEvent

}

local button2 = widget.newButton

{

    left = 50,

    top = 300,

    id = “button2”,

    label = “button2”,

    onEvent = handleButtonEvent

}

What I want is to move the buttons Cundo press any of the two

local widget = require( “widget” )

local button1

local button2

 

– Function to handle button events

local function handleButtonEvent( event )

 

    if ( “ended” == event.phase ) then

        print( “Button was pressed and released” )

        transition.to(button1 , {time = 1000, x = 0})

        transition.to(button2 , {time = 1000, x = 0})

    end

end

 

 

– Create the widget

button1 = widget.newButton

{

    left = 50,

    top = 200,

    id = “button1”,

    label = “button1”,

    onEvent = handleButtonEvent

}

 

 

button2 = widget.newButton

{

    left = 50,

    top = 300,

    id = “button2”,

    label = “button2”,

    onEvent = handleButtonEvent

}

 

This will work

Hello my friend, try using http://docs.coronalabs.com/api/type/EventListener/dispatchEvent.html,

and if event.name = X  you call remove:Self in desired function.

Cheers

thank you, friend, but what I need is to access the button to move it out of view and from a local function can not access. 

some solution?

Please post some samples of your code, will help you with it.

local widget = require( “widget” )

– Function to handle button events

local function handleButtonEvent( event )

    if ( “ended” == event.phase ) then

        print( “Button was pressed and released” )

        transition.to(button1 , {time = 1000, x = 0})

        transition.to(button2 , {time = 1000, x = 0})

    end

end

– Create the widget

local button1 = widget.newButton

{

    left = 50,

    top = 200,

    id = “button1”,

    label = “button1”,

    onEvent = handleButtonEvent

}

local button2 = widget.newButton

{

    left = 50,

    top = 300,

    id = “button2”,

    label = “button2”,

    onEvent = handleButtonEvent

}

What I want is to move the buttons Cundo press any of the two

local widget = require( “widget” )

local button1

local button2

 

– Function to handle button events

local function handleButtonEvent( event )

 

    if ( “ended” == event.phase ) then

        print( “Button was pressed and released” )

        transition.to(button1 , {time = 1000, x = 0})

        transition.to(button2 , {time = 1000, x = 0})

    end

end

 

 

– Create the widget

button1 = widget.newButton

{

    left = 50,

    top = 200,

    id = “button1”,

    label = “button1”,

    onEvent = handleButtonEvent

}

 

 

button2 = widget.newButton

{

    left = 50,

    top = 300,

    id = “button2”,

    label = “button2”,

    onEvent = handleButtonEvent

}

 

This will work