javascript and call context

  • Hi,

    Take this hotspot for instance:

    <hotspot name="h1" onclick="trace(get(name))" url="test.png" />

    when clicked, it will trace h1

    when I call this from javascript:

    krpano.call('hotspot[h1].onclick');

    I get a null. My question is, how can I call the onclick action of a hotspot, but still keep the context. I hope I could avoid this:

    <hotspot name="h1" onclick="trace(get(hotspot[h1].name))" url="test.png" />

    (I know, name is a bad example here, but it points out it's redundentnous, I want to keep it flexible)

  • Hi,

    No I just worked around it. I have a model refference of the hotspot so I just do:

    Code
    krpano.call('showpopup('+this.model.get('name')+')');

    So instead of executing the exact contents of the hotspot, I just dupe it, not real DRY but meh. Perhap Ill put the onclick method in the model too.

    And if your thinking, that's this model talk, Im using backbone.js, sort of mvc framework for javascript.

Jetzt mitmachen!

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