Not sure of the issue here is for my buttons and why if I tap anywere on the screen the scene changes. That and peach’s countdown clock does not seem to work:
main.lua
isplay.setStatusBar( display.HiddenStatusBar )
\_W = display.contentWidth
\_H = display.contentHeight
--====================================================================--
-- IMPORTS
--====================================================================--
local background = display.newImage( "10.png" )
local director = require( "director" )
local ui = require("ui")
local tableView = require("tableViewXL")
------------------
-- Go to intro
------------------
director:changeScene("intro");
intro.lua
module(..., package.seeall)
--Create a new rectangle for the background, color it red
--The number of days remaining
local dayText = display.newText( "88", 0, 0, native.systemFontBold, 30 )
dayText:setTextColor( 0, 0, 0, 200 )
dayText.x, dayText.y = 400, 500
--The number of hours remaining
local hourText = display.newText( "20", 0, 0, native.systemFontBold, 30 )
hourText:setTextColor( 0, 0, 0, 120 )
hourText.x, hourText.y = 400, 470
--The number of minutes remaining
local minutesText = display.newText( "30", 0, 0, native.systemFontBold, 30 )
minutesText:setTextColor( 0, 0, 0, 65 )
minutesText.x, minutesText.y = 400, 440
-- Create labels to indicate what the numbers mean
local dayLabel = display.newText( "days", 0, 0, native.systemFont, 30 )
dayLabel:setTextColor( 255, 255, 255 )
dayLabel.x = 460; dayLabel.y = 440
local hourLabel = display.newText( "hours", 0, 0, native.systemFont, 30 )
hourLabel:setTextColor( 255, 255, 255 )
hourLabel.x = 465; hourLabel.y = 470
local minuteLabel = display.newText( "minutes", 0, 0, native.systemFont, 30 )
minuteLabel:setTextColor( 255, 255, 255 )
minuteLabel.x = 485; minuteLabel.y = 498
--Function to update the countdown clock
local function updateTime()
local time = os.date("\*t")
local daysLeft = 358 - time.yday
if (daysLeft \< 10) then
daysLeft = "0" .. daysLeft
end
dayText.text = daysLeft
local hoursLeft = 23 - time.hour
if (hoursLeft \< 10) then
hoursLeft = "0" .. hoursLeft
end
hourText.text = hoursLeft
local minutesLeft = 60 - time.min
if (minutesLeft \< 10) then
miunteText = "0" .. minutesLeft
end
minutesText.text = minutesLeft
end
local clockTimer = timer.performWithDelay( 1000, updateTime, -0 )
-- Update the clock once per second
local abutton = display.newImage( "logo6.png" )
abutton.x = \_W / 3.2; abutton.y = \_H / 2.9;
local cbutton = display.newImage ("caner.png")
cbutton.x = \_W / 1.66; cbutton.y = \_H / 1.59;
local dbutton = display.newImage ("cha2.png")
dbutton.x = \_W / 1.36; dbutton.y = \_H / 1.59;
local abutton = display.newImage( "logo8.png" )
abutton.x = \_W / 1.6; abutton.y = \_H / 2.6;
local mybutton = display.newImage( "fact.png" )
mybutton.x = \_W / 1.1; mybutton.y = \_H / 1.52;
function openmylink (event)
system.openURL( "http://www.yahoo.com" )
end
mybutton:addEventListener("tap", openmylink)
function new()
local localGroup = display.newGroup()
--------------------------------------------------------------------
--------------------------------------------------------------------
local scrollView = require("scrollView")
local util = require("util")
-- Tells the app what we require. These are both used for scrolling.
-- Sets the background
local localGroup = display.newGroup()
-------------
--button 0
-------------
--
local bt09 = function ( event )
if event.phase == "release" then
director:changeScene( "cons", "moveFromRight" )
end
end
local bt09 = ui.newButton{
default = "bab1.png",
onEvent = bt09,
id = "bt09"
}
bt09.x = \_W / 7.7; bt09.y = \_H / 2.11;
localGroup:insert( bt09 )
--
----------
--button 1
----------
--
local background = display.newImage( "da3.png" )
background.x = \_W / 7.2; background.y = \_H / 2.29;
----------
---button 2
----------
--
local bt05 = display.newImage( "fillb3.png" )
bt05.x = \_W / 3.74; bt05.y = \_H / 1.67;
------------------
--button 3
-------------------
local ratebutton = display.newImage ("feedbackb1.png")
ratebutton.x = \_W / 7.7; ratebutton.y = \_H /1.667;
localGroup:insert(ratebutton)
--\> Adds the Rate It button
local function doRating(event)
if event.phase == "ended" then
local url = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa"
url = url .. "/wa/viewContentsUserReviews?"
url = url .. "type=Purple+Software&id="
url = url .. "404532572"
system.openURL(url)
end
end
ratebutton:addEventListener("touch", doRating)
--\> Adds the Rate It functionality. Be sure to change the APP ID to your OWN; right now it's mine so you can see a working example if you like, but obviously in your own app you'll want it to go to the app's rating/review page!
-------------------
--button 4
-------------------
-------------------
--button 5
-------------------
local background = display.newImage( "pu9.png" )
background.x = \_W / 10.17; background.y = \_H / 1.53;
----------
--button 7
----------
local bt01 = function ( event )
if event.phase == "release" then
director:changeScene( "cos", "moveFromLeft" )
end
end
local bt01 = ui.newButton{
default = "b91.png",
onEvent = bt01,
id = "bt01"
}
--
bt01.x = \_W / 2.68; bt01.y = \_H / 1.66;
localGroup:insert( bt01 )
----------
--button 8
----------
local bt10 = function ( event )
if event.phase == "release" then
director:changeScene( "hhgthree", "moveFromRight" )
end
end
local bt10 = ui.newButton{
default = "b1.png",
onEvent = bt10,
id = "bt10"
}
bt10.x = \_W / 2.39; bt10.y = \_H / 1.49;
localGroup:insert( bt10 )
----------
--button 6
----------
local bt11 = function ( event )
if event.phase == "release" then
director:changeScene( "mes", "moveFromRight" )
end
end
local bt11 = ui.newButton{
default = "b3.png",
onEvent = bt11,
id = "bt11"
}
bt11.x = \_W / 2.56; bt11.y = \_H / 1.91;
localGroup:insert( bt11 )
------------------
-- VARIABLES
------------------
------------------
-- CREATE BOOK
------------------
------------------
-- FADE EFFECT
------------------
return localGroup;
end
updateTime()
[import]uid: 88495 topic_id: 30050 reply_id: 330050[/import]