<include> and krpano.get("hotspot.count");

  • Hi, Klaus!

    Hotspots included via <include> directive does not apear in total count of spots

    It's some kind of bug? Seems that "hotspot.count" is not up to date...

    UPD: Confirmed! Engine have some delay and its impossible to get real count of hotspots in run-time. Same function, initiated when loading completed, shows correct count of spots.

    Solution1: Fastest way to avoid this issue:

    include_me.xml:

    Code
    ....
    <plugin name="cheker" onloaded="checkVisibility" url="%SWFPATH%/images/1pixel_transparent_image.gif"/>
    ....

    Where "checkVisibility" is desired function inside plugin, wich will be executed right in time, when hotspots loaded and added

    Solution2 (concept only):

    my_plugin.as

    Code
    ...
    import flash.utils.Timer;
    var minuteTimer:Timer = new Timer(100, 50);
    minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
    private function onTick(event:TimerEvent):void{
    // call desired function
    }
    ...

    Edited 2 times, last by hades (March 21, 2010 at 4:30 PM).

  • Hi,

    Could you post a pared-down example xml? I tried to duplicate your problem (using the latest version of the krpano) and everything seems to work fine. How are you testing for the number of hotspots?

    Here's my test. There are four xml files: includehotspots.xml which calls includehotspots_inc.xml and includehotspots_inc2.xml. includehotspots_inc2.xml also includes includehotspots_inc3.xml

    includehotspots.xml:

    includehotspots_inc.xml:

    includehotspots_inc2.xml:

    Code
    <hotspot name="hs6"
    	         url="%SWFPATH%../plugins/hotspot_ani_black.swf"
    	         ath="0"
    	         atv="0"
    	         visible="true" enabled="true" handcursor="true" capture="true" children="true"
    		   onloaded="trace('onloaded hs6 hotspot.count=',hotspot.count);"
    		>
    	</hotspot>
    <include url="includehotspots_inc3.xml" />

    includehotspots_inc3.xml:

    Code
    <hotspot name="hs7"
    	         url="%SWFPATH%../plugins/hotspot_ani_black.swf"
    	         ath="0"
    	         atv="0"
    	         visible="true" enabled="true" handcursor="true" capture="true" children="true"
    		   onloaded="trace('onloaded hs7 hotspot.count=',hotspot.count);"
    		>
    	</hotspot>

    output:

    These files trace hotspot.count when the preview is loaded, when onstart, when the xml is completely loaded, and when each of the hotspots is competely loaded. In each case krpano correctly reports the number of hotspots.

    steve

  • Hi, pinsane, its all about Plugins *wink*

    All your tests based on internal events (onxmlcomplete, onpreviewcomplete, onloadcomplete), and I'm talking about AS3 plugin. About

    Code
    ...
    krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
    ...
    krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE, updateEvent);


    happens earlier, than additional xml files would be parsed. Last event rising 6 or 7 times, and result the same

Participate now!

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