local fmenu = function( event )
if event.phase == “ended” then
print(“tap”)
director:changeScene(“menu”)
end
end
menubtn:addEventListener(“touch”,fmenu)
return localGroup
end [import]uid: 82446 topic_id: 16845 reply_id: 316845[/import]
same problem persists.Now “Tap” is being displayed thrice…
MoreOver there is a Page .lua and one more lua file whose code is
This is basically a sliding image app…
double check case of all files “Menu.png” is different from “menu.png”
and try moving the loadSound code to the main.lua file it will still work on all scenes director doesn’t remove sound files from memory and sometimes loading sound causes a lag [import]uid: 7911 topic_id: 16845 reply_id: 63119[/import]
I have checked it all …It is not showing any error nor changing the scene.shall i post the code? [import]uid: 82446 topic_id: 16845 reply_id: 63934[/import]
Please can anybody help me?My problem is still not resolved.Don’t know what to do.got stuck in the middle… [import]uid: 82446 topic_id: 16845 reply_id: 64843[/import]
looking at code in OP you have new(params)
but you not using pamars in code
are you trying to pass params [import]uid: 7911 topic_id: 16845 reply_id: 64845[/import]
you have your tap printing multiple times, because…
there is something that is causing the menuBtn to *not* be removed, so when you change scenes/pages, a new instance is created and then when you click, you get multiple outputs.
yes :).But my concern is not printing tap multiple times but the main concern is that I am not getting error also the change scene is not working.Can you help me out please? [import]uid: 82446 topic_id: 16845 reply_id: 64856[/import]
@rahulsingh2k10, I just copied your code, made a quick changes (see the changed code below), and menubtn works just fine. Touching on it changed the scene to menu scene of mine. So, it doesn’t look like fmenu function has any problem. There could be a problem with your menu.lua.
I have no clue how this param.image works. Passing parameter is one of the things I don’t have good grasp on yet (which is a pain in the neck when I need it bad). Anyhow, if nothing else is causing the issue, this param.image could be triggering some sort of problem for you.
Naomi
[lua]module(…, package.seeall)
function new(params)
local screenW = display.contentWidth;
local screenH = display.contentHeight;
local imgWidth;
local imgHeight;
local fmenu = function( event )
if event.phase == “ended” then
print(“tap”)
director:changeScene(“menu”)
end
end
menubtn:addEventListener(“touch”,fmenu)
Have you try this. Normally if I have object with parameter, I will build a table and use the following method.
local image = display.newImageRect( pagelist[params], 1024, 768 )
please see my sample I normally use.
module(…, package.seeall)
function new()
local localGroup = display.newGroup()
local pagelist = {
“page01.jpg”,
“page02.jpg”,
“page03.jpg”,
}
local function displayobject(params)
local image = display.newImageRect( pagelist[params], 1024, 768 )
image.x = 512
image.y = 384
localGroup:insert( image )
print(params)
local fmenu = function( event )
if event.phase == “ended” then
print(“tap”)
director:changeScene(“page002”)
end
end
menubtn:addEventListener(“touch”,fmenu)
return localGroup
end
[import]uid: 94613 topic_id: 16845 reply_id: 65181[/import]