Error with loadpano

  • I built a simple plugin that registers a click on a box and calls krpano.call("action(load2)"). If the function in the action is loadpano(pano2.xml), I get this:

    Code
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    	at krpano::krpano_plugin/event_click()


    when it loads the new pano even though when this action is called by a hotspot I don't get the error. If I change the function in the load2 action to delayedcall(0,loadpano(pano2.xml)) I don't get an error. Any idea as to what might be going on? I am baffled.
    Thanks

    Edited 2 times, last by marcbn (November 18, 2008 at 9:45 PM).

  • Here is the event listener, I tried both; I thought maybe I should be using the addPluginEventListener instead:

    Code
    button.addEventListener(MouseEvent.CLICK,pluginClick);
    //krpano.addPluginEventListener(button,MouseEvent.CLICK,pluginClick);


    and the pluginClick function:

    Code
    function pluginClick(e:Event) {
    	krpano.call("action(load2)");
    }


    and the XML:

  • this code is okay:

    Code
    button.addEventListener(MouseEvent.CLICK,pluginClick);


    addPluginEventListener is only for special plugin events (REGISTER,RESIZE,UPDATE)

    this code is okay too:

    Code
    function pluginClick(e:Event) {
    krpano.call("action(load2)");
    }

    normally it should work...

    one question - was the "krpano" interface already set?

    Code
    krpano = krpano_as3_interface.getInstance();

    EDIT - once more - does this error appear only on the second click?
    please try to set the "keep" attribute of your plugin to "true" to be sure that the plugin is not unloaded when loading a other pano,

    Code
    <plugin name="testPlugin" url="testPlugin.swf" keep="true" />

    best regards,
    Klaus

Participate now!

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