You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

1

Friday, June 29th 2012, 11:09pm

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)
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

mds

Intermediate

Posts: 152

Location: Athens, GA

Occupation: Designer

  • Send private message

2

Thursday, July 12th 2012, 4:33pm

did you ever figure this out? I'd like to know too! *smile*
Say "Hi!" on twitter

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

3

Thursday, July 12th 2012, 6:10pm

Hi,

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

Source code

1
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.
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).