0

level1.lua スタンドアロンで動作するプログラムがあります。しかし、を使用してナビゲートしたい場合gotoScene()、再生されません!

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

local function level1_pressed()
    storyboard.gotoScene( "level1", "fade" ,40 )
    print("level1 should start")
    return true
end

local level1 = display.newText( "level1",20 ,20,font, 40 )
level1:setTextColor(math.random( 50, 200 ),math.random( 50, 200 ),math.random( 50, 200 ))

level1:addEventListener( "touch", level1_pressed )

これは私のmain.luaです。「level1 should start」文字列が端末に正しく出力されますが、開始されません! 何が問題ですか?

4

2 に答える 2

0

http://docs.coronalabs.com/api/library/storyboard/gotoScene.htmlで入手可能なストーリーボードのドキュメントによると、storyboard.gotoScene() の構文が正しくありませんでした

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

    local options = {
        effect = "fade",
        time = 40
    }

    local function level1_pressed()
            storyboard.gotoScene( "level1", options)
            print("level1 should start")
            return true
    end

    local level1 = display.newText( "level1",20 ,20,font, 40 )
    level1:setTextColor(math.random( 50, 200 ),math.random( 50, 200 ),math.random( 50, 200 ))

    level1:addEventListener( "touch", level1_pressed )
于 2013-08-16T06:09:43.990 に答える
0

ドキュメントを読みましたか?level1.lua には、このようなものが含まれている必要があります。そのページからストーリーボードのチュートリアルもチェックしてください。

于 2013-08-05T17:07:33.760 に答える