Krpano Interface Call function undefined

  • 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

  • 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

  • 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

  • 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:

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

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

    Code
    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

    Code
    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.

    Code
    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

    Code
    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*

  • 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

  • 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

  • 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

Participate now!

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