Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 1 Support › Setting loaded item's width and height to calling item

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4475

    Thomas

    Hey there,

    i guess the title is not really self-explaining, so i’ll try to explain.

     

    I have two qml-files, a Level.qml and a Level02.qml.

    In my Level.qml is a Loader:

        Loader {
            anchors.fill: parent
            id: levelLoader;
            onLoaded: {gameWindow.loadItemWithCocos(item);
            ....
            }
            onSourceChanged: { ... }
        }

    the source gets set in the main.qml.
    The Problem is: as long as i don’t set the width and height of the Level.qml, nothing will get shown.

    But the correct width and height depends on the e.g. Level02.qml. It can be different from level to level. (so Level03.qml has another width and height than Level02.qml)

    How can i set the width and height of Level.qml accordingly to the loaded level??

    things like:

        property variant levelItem: levelLoader.item
        width: levelItem.width
        height: levelItem.height

    or

            onLoaded: {gameWindow.loadItemWithCocos(item);
                level.width = item.width;
                level.height = item.height;
                levelItem = item;
            }
            onSourceChanged: {
               // space_ship_x = 150;
               // space_ship_y = 150;
                level.width = item.width;
                level.height = item.height;
                levelItem = item;
            }

    didn’t really work out. hoping for help…

     

    Cheers,

    TS

    #4519

    Christian
    Felgo Team

    Hi Thomas,

    did you already figure out a solution?

    Cheers, Chris

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.