Array is null after loadscene

  • Hi all, I declare custom xml elements to manage the menu of my tours like the one below.

    <scene_group name="name">
    		<scene name="scene_1" />
    		<scene name="scene_2" />
    		<scene name="scene_3" />
    		<scene name="scene_4" />
    		<scene name="scene_5" />
    		<scene name="scene_6" />
    		<scene name="scene_7" />

    I am able to loop through the content.

    However the code above will only work before any "loadscene" calls, after loadscene it no longer works and when I try to do a check for the count its null


    The debug code above when put before loadscene returns a number but after loadscene it returns null.

    Trying to go through the docs and cant find an explanation. Can anyone enlighten me on what is happening?

  • this works without problem also after scene changes
    maybe it is this ... get(scene_group[get(counter)].scene[get(scene_counter)].name)
    i would avoid nesting too many get() calls

    also in general..
    - set(x, get(y)) is easier/better done by copy(x, y)
    - use local scopes! with global variables like "counter" in multiple functions you easily run into problems

  • Thanks for the tip, will apply it in future code that I write. However my question is in general why is the object null after loadscene? See code below.

    trace("group count is = ", *group.count); <!-- returns a number -->
    loadscene(get(scene[%1].name), null, MERGE|KEEPVIEW, OPENBLEND(0.5, 0.0, 0.75, 0.05, linear) );
    trace("group count is = ", *group.count);<!-- returns null -->

    So I have many of these groups by the way

    Is there a specific reason for this? Cant seem to find it in the documentation.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!