You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, June 3rd 2011, 2:43pm

How to create a polygon hotspot from Actionscript?

Hi,
I am making a gui plugin for adding hotspots and linking panoramas that saves to a database.
So far i can create image hotspots but i don't know how to create a polygon hotspot.

I wasn't able to find how to do it in the docs or on the forum.

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Friday, June 3rd 2011, 3:05pm

Hi hrvoje_86,

Quoted

but i don't know how to create a polygon hotspot.
By defining the coordinates of the polygonal hotspot points: hotspot[name].point[..].ath

SAlut.

3

Friday, June 3rd 2011, 3:15pm

Thanx for the reply i made this function but it doesn't seem to create a polygon.
Am i missing something?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// polyspot
function addGoSpot(e:MouseEvent)
{
	highestN++
	var N = highestN
	selected_hs = "hs"+N
	krpano.call("addHotSpot("+selected_hs+")")

	krpano.set("hotspot["+selected_hs+"].scale", 0.7);
	krpano.set("hotspot["+selected_hs+"].zoom", true);
	
	krpano.set("set(hotspot["+selected_hs+"].fillalpha", 0.25);
	krpano.set("set(hotspot["+selected_hs+"].borderalpha", 0.50);

	krpano.set("set(hotspot["+selected_hs+"].point[0].ath",-50);
	krpano.set("set(hotspot["+selected_hs+"].point[0].atv",-50);
	krpano.set("set(hotspot["+selected_hs+"].point[1].ath",-50);
	krpano.set("set(hotspot["+selected_hs+"].point[1].atv",+50);
	krpano.set("set(hotspot["+selected_hs+"].point[2].ath",+50);
	krpano.set("set(hotspot["+selected_hs+"].point[2].atv",+50);
	krpano.set("set(hotspot["+selected_hs+"].point[3].ath",+50);
	krpano.set("set(hotspot["+selected_hs+"].point[3].atv",-50);
	
	krpano.set("h",0)
	krpano.set("v",0)
	krpano.call("screentosphere(mouse.x,mouse.y,h,v)")
	
	hs = getSprite(selected_hs)
	//hs.addEventListener(MouseEvent.CLICK,endMove)
	//addEventListener(Event.ENTER_FRAME, onMove)
	
	// hs info
	hs_box.selected_hs.text = selected_hs
	
	hs_total++
}

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

4

Friday, June 3rd 2011, 3:18pm

I am sorry to not be of help, but I know nothing about AS3 *huh* ...

SAlut.

5

Tuesday, June 7th 2011, 2:42pm

I'm still stuck at this.
I would appreciate some help.

6

Tuesday, June 7th 2011, 11:25pm

Hi,

adding the hotspot via addhotspot() and setting the points should be normally enough,
but you code is bit wrong,

see here the two set:

Quoted

krpano.set("set(hotspot["+selected_hs+"].fillalpha", 0.25);


either do this - calling the set() xml action - that means the full set action as string as parameter of the call function:

Quoted

krpano.call("set(hotspot["+selected_hs+"].fillalpha, 0.25);");

or do that - directly set the variable via the krpano set interface function: (recommended! better because faster)

Quoted

krpano.set("hotspot["+selected_hs+"].fillalpha", 0.25);

best regards,
Klaus

7

Wednesday, June 8th 2011, 10:58am

Thank you!

8

Thursday, June 9th 2011, 12:27pm

How do i remove 1 point from the hotspot?

9

Wednesday, June 15th 2011, 2:38pm

Hi,

that's more complicated,

either by first copying all elements above the point index that should be deleted one index down,
and then decreasing the count setting about one value,

or by getting the internal array and calling the removeItem() function from it,
e.g.

Source code

1
2
var hotspotspointsarray:Object = krpano.get("hotspot[name].point");
hotspotspointsarray.removeItem(index);


best regards,
Klaus