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.

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

1

Tuesday, April 10th 2012, 1:10am

Krpano Interface Call function undefined

Hi Krpano pals,

Krpano has a javascript interface with 3 functions: set, get and call.

But I'm getting undefined for the call function, while set and get are retrieving correctly.

Odd behavior or I don't know.

I'd appreciate any help on this.

In attachments the print screen of my javascript console.

Regards,
Ciul
ciul has attached the following image:
  • krpano call undefined.jpg

sachagriffin

Professional

Posts: 1,480

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Tuesday, April 10th 2012, 5:36am

Call doesn't return. It's always given undefined for me.
KRPano Developer: Portfolio :: Facebook :: Twitter :: r/VirtualTour

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

3

Tuesday, April 10th 2012, 7:36pm

Solved although still strange

Hi Krpano pals,

finally solved it.

The issue was that my client krpano swf files were old although xml files were new versions.
I just changed the file to one of mines which is latest krpano versions and that's it, not odd behavior anymore.

Although, older versions should have the javascript interface functions too since these are flash external interface native functions, but who knows.

Thank you.

Regards,
Ciul

Zephyr

Professional

Posts: 969

Location: Netherlands

Occupation: Web developer

  • Send private message

4

Friday, April 13th 2012, 4:49pm

It's weird that it works for you, since $('krpano').set would call the set function on the jquery object. To get the DOM Element you need to do $('krpano')[0] or just document.getElementByID('krpano')
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).

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

5

Friday, April 13th 2012, 5:05pm

It's weird that it works for you, since $('krpano').set would call the set function on the jquery object. To get the DOM Element you need to do $('krpano')[0] or just document.getElementByID('krpano')
I use MooTools which is non as intrusive as jQuery, and after updated the krpano.swf file from my client for one of mines which are updated, it worked flawlessly :)

Thanks for sharing your experience Zephyr *thumbup*

Regards,
Ciul

Zephyr

Professional

Posts: 969

Location: Netherlands

Occupation: Web developer

  • Send private message

6

Friday, April 13th 2012, 8:42pm

I like jQuery together with underscore.js and Backbone.js. I made Facebook app with custom tagging plugin
with that :)

Mootoo;s has some nice class like methods, that jquery lacks. But other then that they're both the same, so I never bothered picking up mootools :)
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).

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

7

Friday, April 13th 2012, 8:46pm

Hi Zephyr,

Yeah, I haven't said jQuery can't be capable of doing nice things, just that I use MooTools due to it being a little more advanced when non-DOM stuff is required (that's my personal opinion), otherwise, jQuery is nicer for manipulating DOM and fancy effects. My point of view if biased since I prefer MooTools anyway.

Yeah, I saw your tagging app, I did one myself too on MooTools, it's nice to bind Krpano with other API's out there *smile*

I'm lately working on a new version of something I called MooKrpano, basically is a bunch of scripts which allow me to develop krpano js plugins very quicly. I use it depending my clients needs; lately had shown it's capabilities to krpano pals via skype and they agree is just nice.
Recoding it trying to make it reachable from simple krpano xml syntax, hope I achieve it, wish me luck.

Regards,
Ciul

Zephyr

Professional

Posts: 969

Location: Netherlands

Occupation: Web developer

  • Send private message

8

Thursday, April 19th 2012, 11:39pm

Good Luck ;)

Lately I'm experimenting with Backbone.js together with a REST API and krpano. Backbone has models, views, collections and routes

for instance I can say:

Source code

1
2
var hotspot = new HotspotView({model: new Hotspot()});
hotspot.render()


or even simpeler:
var hotspot = new Hotspot({ath: 10, atv: 10});

Source code

1
2
3
hotspots.add(hotspot); //add it to collection which has hooks to auto render a hotspot in krpano
hotspots.save() //save all hotspots through a REST API directly in the database.
//or just save 1 hotspots, hotspot.save()


And it autogenerates a hotspot within krpano, with a random name and default values and styles.

I dont want a hotspot? Easy

Source code

1
2
hotspot.remove() //removes it from collection
hotspot.destroy() //remove from collection and database


this ofcourse alsoo works with View, Display (which has checks to updateobject()) and Plugins.

Since it's all javascript, binding a jquery ui slider to for instance the x/y or ath/atv values of a hotspot is a piece of cake. I bind the slider change event to update the Hotspot model. The hotspot model listens to changes, and updates krpano automagicly.

Source code

1
hotspot.set({url: 'test.png', ath: 0, atv: 100, customproperty: 'cake', customobject: {yup: 'even nested object'}}


Next to that. Collections allows me to filter real quick. Just show hotspots within a certain ath range? Or all hotspots that open a panorama, or just all hotspots with visible false. Just a few lines

Source code

1
2
3
var visible_hotspots = hotspots.filter(function(hotspot) {
  return hotspot.get("visible") === true;
});


This allows me to work MVC and OOP with krpano. I can create tiny plugins or define hotspots that open popups, locations, videos, galleries etc and create a whole reusuable library.

It's the basis of my CMS now.

Real fun stuff :) I get exited just talking about it *love*
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).

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

9

Thursday, April 19th 2012, 11:49pm

Good Luck ;)

Lately I'm experimenting with Backbone.js together with a REST API and krpano. Backbone has models, views, collections and routes
[...]
Hi Zephyr,

surely sounds exciting, it excited me too, amazing job u have done *thumbup*

CakePHP, Joomla and MooTools are my allies.
I wrote (and currently re-factoring a new version) MooKrpano, which basically is a MooTools Plugin that allows to do what you do with jQuery.

Like:
pano = new Pano(etc etc) it is a wrapper of native createPanoViewer
pano.createHotspot('name', url, {ath: 0, atv: 20}) and so on with plugins, sound, videos and else.

It might be similar just than in a MooTools flavor.

I get excited about this too :)

Regards,
Ciul

Zephyr

Professional

Posts: 969

Location: Netherlands

Occupation: Web developer

  • Send private message

10

Friday, April 20th 2012, 12:06am

Yeah I know mootools have Classes too. But what I discovered with Backbone is the power of events. With the correct binding, I can say hotspot.set({ath: 0}); The hotspot model fires a change event. I can make my view listen to this change event, and let it for instance re-render the hotspot in krpano. Or update some form. So if you bind for instance a jquery slider to a model, and say while sliding do hotspot.set(ath: ui.value) you suddenly see your hotspot live reacting to this sliding. then just do hotspot.save() which is an internal function of backbone (I dont have to write code for that) and it auto posts to the url you provide. I was amazed how easy it all was.

You can alsoo extend stuff. So if you for instance have a good hotspot base. But instead of opening panoramas, make it open a Popup. You just create a new type. var PopupHotspot = Hotspot.extend({});

The only thing I miss in krpano, is dynamicly adding preview and image attributes. Then I wouldnt need xml at all :D
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).

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

11

Friday, April 20th 2012, 12:14am

Yeah I know mootools have Classes too. But what I discovered with Backbone is the power of events. [...]
Hy Zephyr,

I'm glad you discovered that *thumbsup*

Uhh, I am not going deep in MooKrpano but yes, it allows all that too as simple javascript events.

pano = new Pano(...);
var hotspot1 = pano.createHotspot('name', 'url', {options here as any krpano hotspot property});

and to add Events while creating it, just pass the options prefixed with "on".
example:
var hotspot1 = pano.createHotspot('name', 'url', {
onOver: function() {
// do something
},
onUp: function() {
// do something
}
});


or these can be bound after created too with addEvent, just like normal MooTools code.
It is a javascript plugin that abstracts Krpano, just that.

Regards,
Ciul

Similar threads