Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

cant figure out why
Started by babybeanie98 Aug 19 2012 10:47 AM

- - - - -
60 replies to this topic
[TOPIC CONTROLS]
Page 1 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

I cant figure out why I keep getting this error. Can anyone see anything
Runtime error
error loading module 'level1' from file '/Users/babybeanie98/Desktop/Question/level1.lua':
/Users/babybeanie98/Desktop/Question/level1.lua:41: unexpected symbol near '?'
stack traceback:
[C]: ?
[C]: in function 'error'
?: in function 'gotoScene'
...Users/babybeanie98/Desktop/Question/menu.lua:22: in function 'onRelease'
?: in function
?: in function
This what I have in level1:
-----------------------------------------------------------------------------------------
--
-- level1.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "physics" library
--local physics = require "physics"
--physics.start(); physics.pause()

--------------------------------------------

-- forward declarations and other locals
--local screenW, screenH, halfW = display.contentWidth, display.contentHeight, display.contentWidth*0.5

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
--
-- NOTE: Code outside of listener functions (below) will only be executed once,
-- unless storyboard.removeScene() is called.
--
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view

-- create a grey rectangle as the backdrop
local background = display.newRect( 0, 0, screenW, screenH )
background:setFillColor( 255 )

--_W = display.viewableContentWidth
--_H = dislay.viewableContentHeight

--local background = display.newRect(0, 0, _W, _H)
--background:setFillColor (255, 255, 255);

local font = “HelveticaNeue” or native .systemFont;

local label =display.newText(“Tap here to send a text”, 0, 0, font, 18) ;
label:setReferncePoint(display.CenterReferencePoint) ;
label:setTextColor(0, 0, 0) ;
label.x = _W * 0.5;
label.y = _H – 50;

function label:tap(e)
native.showPopup(“sms”,{
body = “I sent this text from my app”,
to = {5550000000”}
}) ;
end

label:addEventListner(“tap”, label);
-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene
and this is what I have in menu:
-----------------------------------------------------------------------------------------
--
-- menu.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "widget" library
local widget = require "widget"

--------------------------------------------

-- forward declarations and other locals
local playBtn

-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()

-- go to level1.lua scene
storyboard.gotoScene( "level1", "fade", 500 )

return true -- indicates successful touch
end

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
--
-- NOTE: Code outside of listener functions (below) will only be executed once,
-- unless storyboard.removeScene() is called.
--
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view

-- display a background image
--local background = display.newImageRect( "background.jpg", display.contentWidth, display.contentHeight )
--background:setReferencePoint( display.TopLeftReferencePoint )
--background.x, background.y = 0, 0

-- create/position logo/title image on upper-half of the screen
--local titleLogo = display.newImageRect( "logo.png", 264, 42 )
--titleLogo:setReferencePoint( display.CenterReferencePoint )
--titleLogo.x = display.contentWidth * 0.5
--titleLogo.y = 100

-- create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
label="test",
labelColor = { default={255}, over={128} },
default="button.png",
over="button-over.png",
width=160, height=40,
onRelease = onPlayBtnRelease -- event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 125

-- all display objects must be inserted into group
--group:insert( background )
--group:insert( titleLogo )
group:insert( playBtn )
end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view

-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)

end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view

-- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)

end

-- If scene's view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view

if playBtn then
playBtn:removeSelf() -- widgets must be manually removed
playBtn = nil
end
end

-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene

please tell me someone can see what is causing the error
uid: 69302 topic_id: 30033 reply_id: 330033


[TOPIC: post.html]
#2

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

It's probably the space between native and .systemFont on line 41
uid: 19626 topic_id: 30033 reply_id: 120273


[TOPIC: post.html]
#3

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

Thanks robmiracle, but that didn't fix the error. so it must be something else just not sure what though.
uid: 69302 topic_id: 30033 reply_id: 120297


[TOPIC: post.html]
#4

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

If you repost your code putting it inside of <code> and </code> tags, it will give us line numbers to look at which will help a lot.
uid: 19626 topic_id: 30033 reply_id: 120323


[TOPIC: post.html]
#5

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

Hello robmiracle,
Im sorry but I am new, how to I repost it inside the code/tags. I know what you mean just not sure how to do it. Do you mind explaining?
uid: 69302 topic_id: 30033 reply_id: 120324


[TOPIC: post.html]
#6

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

type in < code > (leave out the spaces)
paste your code
type in < / code > (again leave out the spaces)

It will retain any indention in your code, provide line numbers, etc. which will make it easier for us to read your code.
uid: 19626 topic_id: 30033 reply_id: 120331


[TOPIC: post.html]
#7

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

-----------------------------------------------------------------------------------------
--
-- level1.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "physics" library
--local physics = require "physics"
--physics.start(); physics.pause()

--------------------------------------------

-- forward declarations and other locals
--local screenW, screenH, halfW = display.contentWidth, display.contentHeight, display.contentWidth*0.5

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
--
-- NOTE: Code outside of listener functions (below) will only be executed once,
-- unless storyboard.removeScene() is called.
--
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view

-- create a grey rectangle as the backdrop
local background = display.newRect( 0, 0, screenW, screenH )
background:setFillColor( 255 )

--_W = display.viewableContentWidth
--_H = dislay.viewableContentHeight

--local background = display.newRect(0, 0, _W, _H)
--background:setFillColor (255, 255, 255);

local font = “HelveticaNeue” or native .systemFont;

local label =display.newText(“Tap here to send a text”, 0, 0, font, 18) ;
label:setReferncePoint(display.CenterReferencePoint) ;
label:setTextColor(0, 0, 0) ;
label.x = _W * 0.5;
label.y = _H – 50;

function label:tap(e)
native.showPopup(“sms”,{
body = “I sent this text from my app”,
to = {5550000000”}
}) ;
end

label:addEventListner(“tap”, label);

-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene

uid: 69302 topic_id: 30033 reply_id: 120343


[TOPIC: post.html]
#8

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

and here is the main.lua thank you for showing me this. Im learning something new each time.
-----------------------------------------------------------------------------------------
--
-- menu.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "widget" library
local widget = require "widget"

--------------------------------------------

-- forward declarations and other locals
local playBtn

-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()

-- go to level1.lua scene
storyboard.gotoScene( "level1", "fade", 500 )

return true -- indicates successful touch
end

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
--
-- NOTE: Code outside of listener functions (below) will only be executed once,
-- unless storyboard.removeScene() is called.
--
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view

-- display a background image
--local background = display.newImageRect( "background.jpg", display.contentWidth, display.contentHeight )
--background:setReferencePoint( display.TopLeftReferencePoint )
--background.x, background.y = 0, 0

-- create/position logo/title image on upper-half of the screen
--local titleLogo = display.newImageRect( "logo.png", 264, 42 )
--titleLogo:setReferencePoint( display.CenterReferencePoint )
--titleLogo.x = display.contentWidth * 0.5
--titleLogo.y = 100

-- create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
label="test",
labelColor = { default={255}, over={128} },
default="button.png",
over="button-over.png",
width=160, height=40,
onRelease = onPlayBtnRelease -- event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 125

-- all display objects must be inserted into group
--group:insert( background )
--group:insert( titleLogo )
group:insert( playBtn )
end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view

-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)

end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view

-- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)

end

-- If scene's view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view

if playBtn then
playBtn:removeSelf() -- widgets must be manually removed
playBtn = nil
end
end

-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene

uid: 69302 topic_id: 30033 reply_id: 120344


[TOPIC: post.html]
#9

srdjan@multimediaworx.com

[GLOBAL: userInfoPane.html]
srdjan@multimediaworx.com
  • Enthusiast

  • 89 posts
  • Corona SDK

You are using wrong quotation marks: “HelveticaNeue” etc...
Change them to ".
Your level1.lua file is full of them (menu.lua looks ok)
uid: 101952 topic_id: 30033 reply_id: 120345


[TOPIC: post.html]
#10

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

change them to what? lol I will change anything to get rid of that error code.
uid: 69302 topic_id: 30033 reply_id: 120346


[TOPIC: post.html]
#11

srdjan@multimediaworx.com

[GLOBAL: userInfoPane.html]
srdjan@multimediaworx.com
  • Enthusiast

  • 89 posts
  • Corona SDK

"

search/replace “ into "
search/replace ” into "
uid: 101952 topic_id: 30033 reply_id: 120349


[TOPIC: post.html]
#12

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

Im sorry but I am not understanding what you mean by search/replace into
uid: 69302 topic_id: 30033 reply_id: 120350


[TOPIC: post.html]
#13

srdjan@multimediaworx.com

[GLOBAL: userInfoPane.html]
srdjan@multimediaworx.com
  • Enthusiast

  • 89 posts
  • Corona SDK

The level1.lua code has syntax errors. You are using wrong blockquotes.

For example, line 43 of your code looks like:
local font = “HelveticaNeue” or native .systemFont;

“HelveticaNeue” is surronded with “ on the left and ” on the right side. Can you see them?

These are wrong chars for a string definition. You should use double-quote instead: "
(it is shift-2 on win keyboard or just simply copy/paste them into your code)

So, after fixing, your line 43 should be:
local font = "HelveticaNeue" or native .systemFont;

“HelveticaNeue” and "HelveticaNeue" are not the same! (the second one is correct)

There are other lines with the same error:
45, 52, 53, 54 (add double quote on the left), 58
uid: 101952 topic_id: 30033 reply_id: 120354


[TOPIC: post.html]
#14

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

It looks like your editing in microsoft word or some other word processor that uses smart quotes. These have curls that curl in depending on which side of the word they are on. Programming languages like Lua use ASCII quotes, either single ', or ". In Word and other word processors when you type in ' or " they convert them to these smart quotes.

To fix this, you need to be in a plain ASCII text editor, like Text Wrangler or Notepad++ (on Windows), select the quote you want to swap out and copy it. Most Replace options are under the Edit menu. You would paste the smart quote in the Find field, type in the regular quote in the replace and then do a replace all.

Repeat that with the end quote and will probably need to repeat for each of the single quotes too.

You can see the right shaped quotes above in the pink colored text in the above code listings. Those have correct quote marks. Any of your strings that are not pink above need the quotes around them replaced with the same quotes as the pink strings.
uid: 19626 topic_id: 30033 reply_id: 120380


[TOPIC: post.html]
#15

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

Thanks everyone. Now I did everything everyone said now nothing is showing for my app. I am still getting the same error :
The file sandbox for this project is located at the following folder:
(/Users/babybeanie98/Library/Application Support/Corona Simulator/Forgetful Memory-D5AEA21B6F8D16A738949C6F4189395B)
Runtime error
error loading module 'level1' from file '/Users/babybeanie98/Desktop/Forgetful Memory/level1.lua':
/Users/babybeanie98/Desktop/Forgetful Memory/level1.lua:42: unexpected symbol near '?'
stack traceback:
[C]: ?
[C]: in function 'error'
?: in function 'gotoScene'
...Users/babybeanie98/Desktop/Forgetful Memory/menu.lua:23: in function 'onRelease'
?: in function
?: in function

menu: I see none of the error it mention
-----------------------------------------------------------------------------------------
--
-- menu.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "widget" library
local widget = require "widget"

--------------------------------------------

-- forward declarations and other locals
local playBtn

-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()
	
	-- go to level1.lua scene
	storyboard.gotoScene( "level1", "fade", 500 )
	
	return true	-- indicates successful touch
end

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
-- 
-- NOTE: Code outside of listener functions (below) will only be executed once,
--		 unless storyboard.removeScene() is called.
-- 
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
	local group = self.view

	-- display a background image
	--local background = display.newImageRect( "background.jpg", display.contentWidth, display.contentHeight )
	--background:setReferencePoint( display.TopLeftReferencePoint )
	--background.x, background.y = 0, 0
	
	-- create/position logo/title image on upper-half of the screen
	--local titleLogo = display.newImageRect( "logo.png", 264, 42 )
	--titleLogo:setReferencePoint( display.CenterReferencePoint )
	--titleLogo.x = display.contentWidth * 0.5
	--titleLogo.y = 100
	
	-- create a widget button (which will loads level1.lua on release)
	playBtn = widget.newButton{
		label="test",
		labelColor = { default={255}, over={128} },
		default="button.png",
		over="button-over.png",
		width=160, height=40,
		onRelease = onPlayBtnRelease	-- event listener function
	}
	playBtn:setReferencePoint( display.CenterReferencePoint )
	playBtn.x = display.contentWidth*0.5
	playBtn.y = display.contentHeight - 125
	
	-- all display objects must be inserted into group
	--group:insert( background )
	--group:insert( titleLogo )
	group:insert( playBtn )
end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
	local group = self.view
	
	-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)
	
end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
	local group = self.view
	
	-- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
	
end

-- If scene's view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
	local group = self.view
	
	if playBtn then
		playBtn:removeSelf()	-- widgets must be manually removed
		playBtn = nil
	end
end
-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene
level 1: I see nothing here either.

-----------------------------------------------------------------------------------------
--
-- menu.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "widget" library
local widget = require "widget"

--------------------------------------------

-- forward declarations and other locals
local playBtn

-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()
	
	-- go to level1.lua scene
	storyboard.gotoScene( "level1", "fade", 500 )
	
	return true	-- indicates successful touch
end

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
-- 
-- NOTE: Code outside of listener functions (below) will only be executed once,
--		 unless storyboard.removeScene() is called.
-- 
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
	local group = self.view

	-- display a background image
	--local background = display.newImageRect( "background.jpg", display.contentWidth, display.contentHeight )
	--background:setReferencePoint( display.TopLeftReferencePoint )
	--background.x, background.y = 0, 0
	
	-- create/position logo/title image on upper-half of the screen
	--local titleLogo = display.newImageRect( "logo.png", 264, 42 )
	--titleLogo:setReferencePoint( display.CenterReferencePoint )
	--titleLogo.x = display.contentWidth * 0.5
	--titleLogo.y = 100
	
	-- create a widget button (which will loads level1.lua on release)
	playBtn = widget.newButton{
		label="test",
		labelColor = { default={255}, over={128} },
		default="button.png",
		over="button-over.png",
		width=160, height=40,
		onRelease = onPlayBtnRelease	-- event listener function
	}
	playBtn:setReferencePoint( display.CenterReferencePoint )
	playBtn.x = display.contentWidth*0.5
	playBtn.y = display.contentHeight - 125
	
	-- all display objects must be inserted into group
	--group:insert( background )
	--group:insert( titleLogo )
	group:insert( playBtn )
end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
	local group = self.view
	
	-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)
	
end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
	local group = self.view
	
	-- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
	
end

-- If scene's view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
	local group = self.view
	
	if playBtn then
		playBtn:removeSelf()	-- widgets must be manually removed
		playBtn = nil
	end
end
uid: 69302 topic_id: 30033 reply_id: 120388


[TOPIC: post.html]
#16

srdjan@multimediaworx.com

[GLOBAL: userInfoPane.html]
srdjan@multimediaworx.com
  • Enthusiast

  • 89 posts
  • Corona SDK

You posted the same file two times...
uid: 101952 topic_id: 30033 reply_id: 120390


[TOPIC: post.html]
#17

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

sorry

menu:
-----------------------------------------------------------------------------------------
--
-- menu.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- include Corona's "widget" library
local widget = require "widget"

--------------------------------------------

-- forward declarations and other locals
local playBtn

-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()
	
	-- go to level1.lua scene
	storyboard.gotoScene( "level1", "fade", 500 )
	
	return true	-- indicates successful touch
end

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
-- 
-- NOTE: Code outside of listener functions (below) will only be executed once,
--		 unless storyboard.removeScene() is called.
-- 
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
	local group = self.view

	-- display a background image
	--local background = display.newImageRect( "background.jpg", display.contentWidth, display.contentHeight )
	--background:setReferencePoint( display.TopLeftReferencePoint )
	--background.x, background.y = 0, 0
	
	-- create/position logo/title image on upper-half of the screen
	--local titleLogo = display.newImageRect( "logo.png", 264, 42 )
	--titleLogo:setReferencePoint( display.CenterReferencePoint )
	--titleLogo.x = display.contentWidth * 0.5
	--titleLogo.y = 100
	
	-- create a widget button (which will loads level1.lua on release)
	playBtn = widget.newButton{
		label="test",
		labelColor = { default={255}, over={128} },
		default="button.png",
		over="button-over.png",
		width=160, height=40,
		onRelease = onPlayBtnRelease	-- event listener function
	}
	playBtn:setReferencePoint( display.CenterReferencePoint )
	playBtn.x = display.contentWidth*0.5
	playBtn.y = display.contentHeight - 125
	
	-- all display objects must be inserted into group
	--group:insert( background )
	--group:insert( titleLogo )
	group:insert( playBtn )
end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
	local group = self.view
	
	-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)
	
end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
	local group = self.view
	
	-- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
	
end

-- If scene's view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
	local group = self.view
	
	if playBtn then
		playBtn:removeSelf()	-- widgets must be manually removed
		playBtn = nil
	end
end

-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene

level1:

-----------------------------------------------------------------------------------------
--
 --level1.lua
--
-----------------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
-- 
-- NOTE: Code outside of listener functions (below) will only be executed once,
--		 unless storyboard.removeScene() is called.
-- 
-----------------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
	local group = self.view

	-- create a grey rectangle as the backdrop
	local background = display.newRect( 0, 0, screenW, screenH )
	background:setFillColor( 255 )
	

local font = "HelveticaNeue" or native.systemFont;

local label =display.newText("Tap here to send a text", 0, 0, font, 18) ;
label:setReferncePoint(display.CenterReferencePoint) ;
label:setTextColor(0, 0, 0) ;  
label.x = _W * 0.5;
label.y = _H – 50;

function label:tap(e)
        native.showPopup("sms",{
                 body = "I sent this text from my app",
	          to = {5550000000}
}) ;
end

label:addEventListner("tap", label);

-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------

-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )

-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )

-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )

-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )

-----------------------------------------------------------------------------------------

return scene
uid: 69302 topic_id: 30033 reply_id: 120392


[TOPIC: post.html]
#18

srdjan@multimediaworx.com

[GLOBAL: userInfoPane.html]
srdjan@multimediaworx.com
  • Enthusiast

  • 89 posts
  • Corona SDK

Your scene:createScene( event ) function is not closed.

Add "end" (without quotes :-) after "label:addEventListner("tap", label);" (line 42)
uid: 101952 topic_id: 30033 reply_id: 120396


[TOPIC: post.html]
#19

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

on line 33 above, you have another special character. The dash between _H and the 50 is an "mdash" not an ASCII hyphen. erase it and put in a regular "-" and you should be good to go.

Though when I tried to run the module through Lua's processor it complained that you are missing an "end" somewhere. So you are likely to hit that as well.

You are missing the "end" for the createScene function.
uid: 19626 topic_id: 30033 reply_id: 120397


[TOPIC: post.html]
#20

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

I dont know I am still getting the exact same error even after making the changes suggested. but I am not certain where to put the "end" createScene function on which one
uid: 69302 topic_id: 30033 reply_id: 120402


[TOPIC: post.html]
#21

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

-----------------------------------------------------------------------------------------
--
 --level1.lua
--
-----------------------------------------------------------------------------------------
 
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
 
-----------------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
-- 
-- NOTE: Code outside of listener functions (below) will only be executed once,
--               unless storyboard.removeScene() is called.
-- 
-----------------------------------------------------------------------------------------
 
-- Called when the scene's view does not exist:
function scene:createScene( event )
        local group = self.view
 
        -- create a grey rectangle as the backdrop
        local background = display.newRect( 0, 0, screenW, screenH )
        background:setFillColor( 255 )
        
 
local font = "HelveticaNeue" or native.systemFont;
 
local label =display.newText("Tap here to send a text", 0, 0, font, 18) ;
label:setReferncePoint(display.CenterReferencePoint) ;
label:setTextColor(0, 0, 0) ;  
label.x = _W * 0.5;
label.y = _H - 50;
 
function label:tap(e)
        native.showPopup("sms",{
                 body = "I sent this text from my app",
                  to = {5550000000}
}) ;
end
 
label:addEventListner("tap", label);
 
-- **********
-- this is the "end" that is missing
-- ***********
end
 
-----------------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
-----------------------------------------------------------------------------------------
 
-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )
 
-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )
 
-- "exitScene" event is dispatched whenever before next scene's transition begins
scene:addEventListener( "exitScene", scene )
 
-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )
 
-----------------------------------------------------------------------------------------
 
return scene
uid: 19626 topic_id: 30033 reply_id: 120403


[TOPIC: post.html]
#22

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

what does it want me to do on release? when I comment it out I get no error, but at the same time the button doesn't work anymore.
uid: 69302 topic_id: 30033 reply_id: 120404


[TOPIC: post.html]
#23

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

but I have added the end since you pointed it out. but the error is in reference to onrelease and go to scene. and I only get the error if I dont comment out on release on the menu.lua file
uid: 69302 topic_id: 30033 reply_id: 120407


[TOPIC: post.html]
#24

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

What error message are you getting now?
uid: 19626 topic_id: 30033 reply_id: 120409


[TOPIC: post.html]
#25

babybeanie98

[GLOBAL: userInfoPane.html]
babybeanie98
  • Contributor

  • 151 posts
  • Corona SDK

I am still getting the same one I originally posted:
/Users/babybeanie98/Desktop/Forgetful Memory/level1.lua:34: unexpected symbol near '?'
stack traceback:
[C]: ?
[C]: in function 'error'
?: in function 'gotoScene'
...Users/babybeanie98/Desktop/Forgetful Memory/menu.lua:22: in function 'onRelease'
?: in function
?: in function

If I comment it the onRelease out. then the error goes away but then when I click on the button is does nothing.
uid: 69302 topic_id: 30033 reply_id: 120414



[topic_controls]
Page 1 of 3 1 2 3
 
[/topic_controls]