Forums

OverviewV-Play 1 SupportFlickable › Reply To: Flickable

OverviewV-Play 1 SupportFlickable › Reply To: Flickable
#4496

Heini

Hi Chris,

regarding the contentY property, i´m not able to make it run correctly. It is another flickable for the highscore. Please try the following code and tell me what i´m doing wrong. In this example i try to navigate to the 35th item, that has another image as the others. It wont work…

import VPlay 1.0
import QtQuick 1.1

GameWindow {
    activeScene: scene

    width: 960
    height: 640
    
    Scene {
        id: scene

        property int itemHeight: 20

        Component {
            id: levelItemDelegate

            Image{
                id: testimage
                height: scene.itemHeight
                width: scene.width *0.75
                source: index === 35 ? "flickBack1.png" : "flickBack.png"

            }
        }

        Flickable {
            id: flickable
            anchors.centerIn: parent

            width: scene.width * 0.75
            height: scene.height * 0.8

            contentWidth: column.width
            contentHeight: column.height
            flickableDirection: Flickable.VerticalFlick

            clip: true //doesn´t matter

            Column {
                id: column
                anchors.centerIn: parent

                Repeater {
                    id: repeater
                    model: 100
                    delegate: levelItemDelegate

                }
            }
        }
       Component.onCompleted: {

           var zentralItemIndex = (scene.height/2) / scene.itemHeight;

           flickable.contentY = (35 * scene.itemHeight) - (zentralItemIndex * scene.itemHeight)


       }

    }
}

Thank you!

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support