args not working for loadscene

  • I'm trying to pass variables to an action. But when using a variable for the loadscene I just get "null" as error.

    This is the action:

    Code
    <action name="startVideo" scope="local" args="var1,var2">set(layer[video].visible,true);set(layer[video].onvideoplay, eventstarter(); loadscene(get(var2), null, MERGE|KEEPPLUGINS));layer[video].playvideo(get(var1));</action>


    And this is the calling:

    Code
    onclick="startVideo(pano-images/test.mp4, Pano_01);"


    When using trace the variable is correctly printed in the console, and the first variable for the video url is also working. Just not the loadscene.

  • inside startVideo() you create a new action layer[video].onvideoplay
    which is called later, when the video starts to play

    onvideoplay() is not called with your arguments var1 and var2 from startVideo()
    so var2 is undefined / null at that point

    so in startVideo you create onvideoplay with the contents of var2 not with "var2"
    you can add trace(layer[video].onvideoplay); atfter creating it to check how it works

Participate now!

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