Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Freitag, 3. Juni 2011, 14:43

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.

2

Freitag, 3. Juni 2011, 15:05

Hi hrvoje_86,

Zitat

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

Freitag, 3. Juni 2011, 15:15

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

Quellcode

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++
}

4

Freitag, 3. Juni 2011, 15:18

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

SAlut.

5

Dienstag, 7. Juni 2011, 14:42

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

6

Dienstag, 7. Juni 2011, 23:25

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:

Zitat

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:

Zitat

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)

Zitat

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

best regards,
Klaus

7

Mittwoch, 8. Juni 2011, 10:58

Thank you!

8

Donnerstag, 9. Juni 2011, 12:27

How do i remove 1 point from the hotspot?

9

Mittwoch, 15. Juni 2011, 14:38

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.

Quellcode

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


best regards,
Klaus