5 hours and no progress...HELP :)

Ok, I’ve been hacking at this for 5 hours now. All I am trying to do is use the director class to transition from screen to screen and the UI class to draw a button that will print a Hello World on the screen. Maybe I’ve been programming in VB.NET and ASP.NET too long LOL…

main.lua

display.setStatusBar( display.HiddenStatusBar ) --Hide status bar from the beginning  
  
-- Import director class  
local director = require("director")  
  
-- Create a main group  
local mainGroup = display.newGroup()  
  
-- Main function  
local function main()  
  
 -- Add the view to the group  
 mainGroup:insert(director.directorView)  
  
 director:changeScene( "mainmenu" )  
  
 return true  
end  
  
-- Begin  
main()  

mainmenu.lua

module(..., package.seeall)  
  
-- our new function  
function new()  
 -- group that we are going to return to the screen  
 local menuGroup = display.newGroup()  
  
 -- use the UI class for our buttons  
 local ui = require( "ui" )  
  
 local drawScreen = function()  
  
  
  
 local startBtn  
  
 -- start button event code  
 local onStartTouch = function( event )  
 if event.phase == "release" and not isLevelSelection and startBtn.isActive then  
  
 print( "Start Button Pressed." )  
  
 local myText = display.newText( "Hello World!!!", 20, 40, native.systemFont, 36 )  
 myText:setTextColor( 255, 255, 255 )  
  
 end  
  
 end  
  
  
 -- add our start button  
 startBtn = ui.newButton{  
 defaultSrc = "start\_btn\_up.png",  
 defaultX = 0,  
 defaultY = 0,  
 overSrc = "start\_btn\_down.png",  
 overX = 0,  
 overY = 0,  
 onEvent = onStartTouch,  
 id = "StartButton",  
 text = "",  
 font = "Helvetica",  
 textColor = { 255, 255, 255, 255 },  
 size = 16,  
 emboss = false  
 }  
 startBtn.x = 0 level1Btn.y = 0  
 startBtn.isVisible = true  
  
 menuGroup:insert( startBtn )  
  
 end  
  
 -- load the screen  
 drawScreen()  
 -- return the menuGrp object  
 return menuGroup  
end  

If you need me to post the director and UI classes, please let me know. I mean this is pretty basic. Also the 2 images are in the same folder in the root. Any help would be much appreciated. Thanks.

Joe… [import]uid: 12765 topic_id: 4604 reply_id: 304604[/import]

the typo on line 47 of mainmenu.lua has been corrected but still not getting anywhere… [import]uid: 12765 topic_id: 4604 reply_id: 14518[/import]

ok, after smashing my head through my desktop I came to realize I needed 2 more cafe’ mochas from Starbucks to notice that I had the x and y values set to 0. Apparently I was thinking coordinates for positioning, not x and y for size. So the button was actually there all along, just hidden in a 0x0 pixel space. Gotta love it :slight_smile:

Joe… [import]uid: 12765 topic_id: 4604 reply_id: 14526[/import]