You are not logged in.

1

Thursday, October 17th 2013, 5:40pm

Hotspot clicked in a loaded pano? (as3)

How can I achieve the subject? Let's assume I add a hotspot using the pano's xml:

Source code

1
2
3
<hotspot name="hs1" alpha="0">
		...the points
</hotspot>


Now I will load this pano into another swf file and use the following:

Source code

1
2
3
4
5
6
7
8
9
10
11
...(e.target.content as Object).embeddedstartup(stage, panoReady);

function panoReady(krpanointerface:krpano_as3_interface):void {
	krpano = krpanointerface;
	var area = krpano.get("area");
	area.x = 0;
	area.y = 0;
	area.width = 1000;
	area.height = 600;
	krpano.call("loadpano(./p.xml,null,MERGE,NOBLEND;");
}


Now I need to call a function when the hotspot 'hs1' is clicked, however I am unable to retrieve the reference to the sprite. How can I do that? Thanks.

2

Tuesday, October 22nd 2013, 6:01pm

Hi,

first get the hotspot object:

Source code

1
var hotspot:* = krpano.get("hotspot[hs1]");


and than assign the onclick property to a custom as3 function:

Source code

1
hotspot.onclick = function():void { ... };


Best regards,
Klaus