Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua 事件。相位不工作电晕_Lua_Transition_Coronasdk_Touch Event - Fatal编程技术网

Lua 事件。相位不工作电晕

Lua 事件。相位不工作电晕,lua,transition,coronasdk,touch-event,Lua,Transition,Coronasdk,Touch Event,当我在主文件中运行时,我的代码运行平稳,但当我在其他lua文件中编写此代码并在director.lua的帮助下调用该文件时,它无法识别触摸时结束的事件阶段。请帮帮我。 提前谢谢。 这是我的密码 function touched( event ) if event.phase == "ended" then if(event.x - event.xStart > 30)then sliding = true;

当我在主文件中运行时,我的代码运行平稳,但当我在其他lua文件中编写此代码并在director.lua的帮助下调用该文件时,它无法识别触摸时结束的事件阶段。请帮帮我。 提前谢谢。 这是我的密码

        function touched( event )
        if  event.phase == "ended"  then
        if(event.x - event.xStart > 30)then
           sliding = true;
           line = display.newLine(event.xStart, event.yStart, event.x, event.y)
           line:setColor(255,0,0)
           line.width = 5

          else

            print("just a touch")

          end

       end
    end
   Runtime:addEventListener("touch", touched , -1)

我刚刚用一个标准的Director main.lua文件和一个scene1.lua文件测试了这一点,该文件只包含上面文章中的代码,效果很好

你可以提供更多的代码,上传你的项目的zip或者分享关于你的项目的任何注释,这些都有助于找出为什么会发生这种情况


我建议你像我刚才那样创建一个基本的应用程序,然后试着运行它;如果问题仍然存在,您可以提交一个bug,尽管正如我前面所说,事件阶段对我来说很好。

嘿,谢谢您的建议。我的项目包含很多场景。如果我在每次更改场景中使用情节串连板,它将使用大量内存(即使我清除并删除了以前的场景)。任何建议。顺便说一句,我放弃了director.lua,采用了故事板。