Reference error when using a variable inside the callwith(); action

  • Hi!

    I use styles extensively and today also tried to use a variable inside the callwith(); action. Like this:

    Code
    callwith(hotspot[get(targetspot)], pause(););

    where "targetspot" is the name of the needed videospot. But I get this in the log:

    ERROR: Calling action 'callwith' failed! ReferenceError: Error #1069


    I wonder if it's possible to use get(); inside callwith();


    thanks!

  • Hi,

    the get() should be no problem.

    But the problem itself is strange - I can't currently image a case where this could happen... maybe when something bad would happen in the 'pause' function, but even that shouldn't be possible...

    Can you show a small example where this happens?

    Best regards,
    Klaus

  • Hi)

    Yes, here's the link: http://tours.viewit360.se/develop/bug_reports/reference/
    And code: http://tours.viewit360.se/develop/bug_re…erence/tour.xml

    The idea is to have the video on the wall and near it there's a hotspot by clicking which a) the wall video must pause and b) youtube video must start to play. As there could be many such hotspots I decided to use style for them with "targetspot" parameter to know which video must be paused. And here this error occured.

  • Hi,

    the error is correct, your xml code is wrong:

    Your variable 'targetvideo' is defined with that value:

    Zitat

    targetvideo="J3LYTge4jB8"


    and in your onclick event you are trying to use that variable to get a hotspot with that name:

    Zitat

    onclick="callwith(hotspot[get(targetvideo)], pause(););


    but there is no hotspot with that name!
    You probably wanted to use 'targetspot' instead of 'targetvideo'...

    Best regards,
    Klaus

  • Hi!

    sure, I was inattentive here...((

    Of course it is "targetspot" which must be checked. But again, the error is still there.

    Check out updated link:

    http://tours.viewit360.se/develop/bug_reports/reference/

    http://tours.viewit360.se/develop/bug_re…erence/tour.xml

    I added trace(); before the callwith and it returns the right name of the hotspot to be paused (video_to_pause). But callwith still give reference error. Hmm... Am I so inattentive here to miss something else very obvious?? *cry*

    Sometimes I feel myself "blind".... *wacko* *wacko*

  • Hi,

    right, there is still a problem here - I've check my code again - internally the local scope reference when resolving the first callwith parameter is missing... (I was unfortunately inattentive too ;-))

    That means the 'get()' can't be resolved correctly in this case, because it can't access the 'hotspot' scope.
    This will be fixed in the next release (1.18.1).

    As workaround you could 'resolve' the hotspot object manually first and then use the hotspot object directly,
    e.g.
    instead of:

    Code
    callwith(hotspot[get(targetspot)], pause(););


    do this:

    Code
    copy(hs, hotspot[get(targetspot)]); 
    callwith(hs, pause(););

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!