Is there a way to forward reference an ui button as we can do with other components. Check the attached code:
local act\_action\_421
local Shape1
local Layer1
function act\_action\_421 (event)
transitionStash.newTransition = transition.to( Shape 1, {alpha=0, time=1000, delay=0})
end
Layer1 = display.newImageRect( imgDir.. "p1\_layer1.png", 1024, 768 );
Layer1.x = 512; Layer1.y = 384; Layer1.alpha = 1
local onShape1Touch = function(event)
if event.phase=="ended" then
act\_action\_421()
end
end
Shape1 = ui.newButton{
defaultSrc=imgDir.."p1\_shape1.png",
defaultX = 280,
defaultY = 70,
overSrc=imgDir.."p1\_shape1.png",
overX = 280,
overY = 70,
onRelease=onShape1Touch,
id="Shape1Button"
}
Shape1.x = 401; Shape1.y = 362; Shape1.alpha = 1
When the button is hit, I get the following error (originally the transitionStash line is 23):
error loading module ‘page_1’ from file ‘/Users/mac/Documents/Kwik/toLixo/build/page_1.lua’:
/Users/mac/Documents/Kwik/toLixo/build/page_1.lua:23: ‘)’ expected near ‘1’
Ideas??
thanks, [import]uid: 4883 topic_id: 17310 reply_id: 317310[/import]
thanks a lot Raul! [import]uid: 4883 topic_id: 17310 reply_id: 65472[/import]