Java Corona SDK中的情节提要滚动视图

Java Corona SDK中的情节提要滚动视图,java,android,html,iphone,lua,Java,Android,Html,Iphone,Lua,我现在太困了,因为我试图让滚动视图在情节提要中工作。我在Corona的scroll view中玩了一个文件/示例应用程序,scroll view可以找到它,因为它不遵循故事板。当我开始玩我的游戏时,我会把我的图像放在板条箱屏幕上,但当我尝试插入滚动视图时,它不起作用。有人能把这个文件的故事板格式我会非常感激。这是文件 display.setStatusBar( display.HiddenStatusBar ) local bg = display.newImage ("bg.png")

我现在太困了,因为我试图让滚动视图在情节提要中工作。我在Corona的scroll view中玩了一个文件/示例应用程序,scroll view可以找到它,因为它不遵循故事板。当我开始玩我的游戏时,我会把我的图像放在板条箱屏幕上,但当我尝试插入滚动视图时,它不起作用。有人能把这个文件的故事板格式我会非常感激。这是文件

display.setStatusBar( display.HiddenStatusBar ) 

local bg = display.newImage ("bg.png")

local widget = require( "widget" )

-- Our ScrollView listener
local function scrollListener( event )
    local phase = event.phase
    local direction = event.direction

    if "began" == phase then
        --print( "Began" )
    elseif "moved" == phase then
        --print( "Moved" )
    elseif "ended" == phase then
        --print( "Ended" )
    end

    -- If the scrollView has reached it's scroll limit
    if event.limitReached then
        if "up" == direction then
            print( "Reached Top Limit" )
        elseif "down" == direction then
            print( "Reached Bottom Limit" )
        elseif "left" == direction then
            print( "Reached Left Limit" )
        elseif "right" == direction then
            print( "Reached Right Limit" )
        end
    end

    return true
end

-- Create a ScrollView
local scrollView = widget.newScrollView
{
    left = 0,
    top = 0,
    width = display.contentWidth,
    height = display.contentHeight,
    bottomPadding = 50,
    id = "onBottom",
    horizontalScrollDisabled = true ,
    verticalScrollDisabled = false ,
    hideBackground = true, 
    listener = scrollListener,
}


local worlds = display.newImage ("pink.png")
worlds.x = 100
worlds.y = 100
scrollView:insert( worlds)


local worlds1 = display.newImage ("pink.png")
worlds1.x = 100
worlds1.y = 800
scrollView:insert( worlds1)


local worlds2 = display.newImage ("pink.png")
worlds2.x = 100
worlds2.y = 500
scrollView:insert( worlds2)


local worlds3 = display.newImage ("pink.png")
worlds3.x = 100
worlds3.y = 1000
scrollView:insert( worlds3)


local worlds4 = display.newImage ("pink.png")
worlds4.x = 100
worlds4.y = 2000
scrollView:insert( worlds4)

我是一个新手。如果有人能回答我的问题,我会非常感激。如果你需要我放在故事板上的文件,请留下评论,我会编辑,但我看不出任何原因,因为它不起作用。我只想要故事板格式的文件。

这是作曲家格式。故事板和作曲家都是一样的

  display.setStatusBar( display.HiddenStatusBar ) 
本地编写器=需要(“编写器”)

本地场景=composer.newScene()

本地小部件=需要(“小部件”)

功能场景:创建(事件)

结束

功能场景:演出(活动)

结束

--“场景:隐藏()” 功能场景:隐藏(事件)

结束

--“场景:销毁()” 功能场景:销毁(事件)

结束


--侦听器设置 场景:addEventListener(“创建”,场景) 场景:addEventListener(“显示”,场景) 场景:addEventListener(“隐藏”,场景) 场景:addEventListener(“销毁”,场景)


返场

当你叫故事板时,你在这里叫 gotoScene(您的故事板或作曲家文件名)

local sceneGroup = self.view
local bg = display.newImage ("bg.png")

-- Initialize the scene here.
-- Example: add display objects to "sceneGroup", add touch listeners, etc.
-- Our ScrollView listener
local function scrollListener( event )
    local phase = event.phase
    local direction = event.direction

    if "began" == phase then
        --print( "Began" )
    elseif "moved" == phase then
        --print( "Moved" )
    elseif "ended" == phase then
        --print( "Ended" )
    end

    -- If the scrollView has reached it's scroll limit
    if event.limitReached then
        if "up" == direction then
            print( "Reached Top Limit" )
        elseif "down" == direction then
            print( "Reached Bottom Limit" )
        elseif "left" == direction then
            print( "Reached Left Limit" )
        elseif "right" == direction then
            print( "Reached Right Limit" )
        end
    end

    return true
end

-- Create a ScrollView
local scrollView = widget.newScrollView
{
    left = 0,
    top = 0,
    width = display.contentWidth,
    height = display.contentHeight,
    bottomPadding = 50,
    id = "onBottom",
    horizontalScrollDisabled = true ,
    verticalScrollDisabled = false ,
    hideBackground = true, 
    listener = scrollListener,
}


local worlds = display.newImage ("images (2).jpg")
worlds.x = 100
worlds.y = 100
scrollView:insert( worlds)

local worlds1 = display.newImage ("images (2).jpg")
worlds1.x = 100
worlds1.y = 800
scrollView:insert( worlds1)


local worlds2 = display.newImage ("images (2).jpg")
worlds2.x = 100
worlds2.y = 500
scrollView:insert( worlds2)


local worlds3 = display.newImage ("images (2).jpg")
worlds3.x = 100
worlds3.y = 1000
scrollView:insert( worlds3)


local worlds4 = display.newImage ("images (2).jpg")
worlds4.x = 100
worlds4.y = 2000
scrollView:insert( worlds4)
    sceneGroup:insert(scrollView)
local sceneGroup = self.view
local phase = event.phase

if ( phase == "will" ) then
    -- Called when the scene is still off screen (but is about to come on screen).
elseif ( phase == "did" ) then
    -- Called when the scene is now on screen.
    -- Insert code here to make the scene come alive.
    -- Example: start timers, begin animation, play audio, etc.
end
local sceneGroup = self.view
local phase = event.phase

if ( phase == "will" ) then
    -- Called when the scene is on screen (but is about to go off screen).
    -- Insert code here to "pause" the scene.
    -- Example: stop timers, stop animation, stop audio, etc.
elseif ( phase == "did" ) then
    -- Called immediately after scene goes off screen.
end
local sceneGroup = self.view

-- Called prior to the removal of scene's view ("sceneGroup").
-- Insert code here to clean up the scene.
-- Example: remove display objects, save state, etc.