AS3 dynamically create hotspot no longer works in 2012 10 05 release

  • I used the following to dynamically create a hotspot from an AS3 plugin a couple years ago. I've recently upgraded to 1.0.8.15 (2012-10-05) and it no longer works. I can't see anything in the documentation that shows why it doesn't work. Is there some new way to do this?

    "khotspot.visible" fails with error "cannot access property or method of a null object reference"

    Code
    krpano.call("addhotspot("+hsName+");")
    var khotspot:Object = krpano.get("hotspot["+hsName+"]");
    
    
    khotspot.visible = true;
  • Hi,

    such code was never guaranteed to work.

    The problem is that the 'call(..)' actions weren't executed synchronized.
    That means after the call() you can't be sure, that the given actions were already executed.

    One solution would be using a callback from the xml actions to your own code to make sure that everything gets executed in the right order. This could be done by setting a custom xml variable to your AS3 function.

    Or the other/easier solution - krpano provides the addplugin/addhotspot actions also as directly callable functions - get and use the function directly - so there will be no delay or synchronizations problems:
    e.g.

    Code
    var krpano_addhotspot:Function = krpano.get("addhotspot");
    krpano_addhotspot(hsName);
    var khotspot:Object = krpano.get("hotspot["+hsName+"]");

    Best regards,
    Klaus

Jetzt mitmachen!

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