Sie sind nicht angemeldet.

1

Freitag, 6. August 2010, 11:48

[resolved] hotspot position

Hi all,

i'm building a virtual tour with krpano (great work btw !). I have to load krapno into a bigger application. So, i use the as3 interface. It just works fine to load pano and command it.
I now just need to create my own swf hotspots. I started with a test (just a red circle)

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package kr_plugins.textHotspot 
{
	import flash.display.Sprite;
	import flash.events.DataEvent;
	import flash.events.Event;
	
	
	public class Main extends Sprite
	{
		
		private var krpano:krpano_as3_interface;
		private var plugin_path:String;
		private var plugin_object:Object;
		
		//--------------------------------------------------------------------------------
		// CONSTRUCTEUR
		//--------------------------------------------------------------------------------
		public function Main() 
		{
			if (stage == null) {
				this.addEventListener(Event.ADDED_TO_STAGE, _addedToStage)
			}
		}
		/**
		 * le hotspot a été chargé
		 * @param	e
		 */
		private function _addedToStage(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, _addedToStage);
			
			this.krpano = krpano_as3_interface.getInstance();
			//this.krpano.trace(krpano_as3_interface.ERROR, 'pouet');
			this.krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, _registerEvent);
			
			this.graphics.beginFill(0xFF0000);
			this.graphics.drawCircle(5, 5, 10);
		}
		
		private function _registerEvent(evt:DataEvent):void
		{
				plugin_path   = evt.data;
				plugin_object = krpano.get(plugin_path);
				
				trace (plugin_path);
				trace (plugin_object);
		}
		
	}

}


The hotspot is loaded in an other class with

Quellcode

1
2
3
4
5
6
7
8
        	// chargement du pano
        	this._krpano.call("loadPano('" + vURLXML + "')");
			this._krpano.set('area.height', this._stage.height);
        	// création du hotspot
			this._krpano.call("addhotspot(hotspot1);");
			this._krpano.set("hotspot[hotspot1].url", GXML.getPath("krpano.plugins") + "textHotspot.swf");
			this._krpano.set("hotspot[hotspot1].ath", "18");
			this._krpano.set("hotspot[hotspot1].atv", "10");


everything is quite perfect *love*
BUT... *cry*
the position of the hotspot in the pano is not fixed. It moves depending the look position.

I certainly miss a parameter or made something wrong, but i just can't find where...

Here is my xml

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
37
<krpano version="1.0.8" ispartialpano="true">

<include url="skin/defaultskin.xml" />

<view hlookat="0" vlookat="0" fovmax="90" maxpixelzoom="1.0" limitview="range" vlookatmin="-90" vlookatmax="90" />
<display details="22" />

<preview type="CUBESTRIP" url="salon_marechaux.tiles/preview.jpg" />

<image type="CUBE" multires="true" tilesize="579">
<level tiledimagewidth="3183" tiledimageheight="3183">
<left url="salon_marechaux.tiles/l3_l_%0v_%0h.jpg" />
<front url="salon_marechaux.tiles/l3_f_%0v_%0h.jpg" />
<right url="salon_marechaux.tiles/l3_r_%0v_%0h.jpg" />
<back url="salon_marechaux.tiles/l3_b_%0v_%0h.jpg" />
<up url="salon_marechaux.tiles/l3_u_%0v_%0h.jpg" />
<down url="salon_marechaux.tiles/l3_d_%0v_%0h.jpg" />
</level>
<level tiledimagewidth="1592" tiledimageheight="1592">
<left url="salon_marechaux.tiles/l2_l_%0v_%0h.jpg" />
<front url="salon_marechaux.tiles/l2_f_%0v_%0h.jpg" />
<right url="salon_marechaux.tiles/l2_r_%0v_%0h.jpg" />
<back url="salon_marechaux.tiles/l2_b_%0v_%0h.jpg" />
<up url="salon_marechaux.tiles/l2_u_%0v_%0h.jpg" />
<down url="salon_marechaux.tiles/l2_d_%0v_%0h.jpg" />
</level>
<level tiledimagewidth="796" tiledimageheight="796">
<left url="salon_marechaux.tiles/l1_l_%0v_%0h.jpg" />
<front url="salon_marechaux.tiles/l1_f_%0v_%0h.jpg" />
<right url="salon_marechaux.tiles/l1_r_%0v_%0h.jpg" />
<back url="salon_marechaux.tiles/l1_b_%0v_%0h.jpg" />
<up url="salon_marechaux.tiles/l1_u_%0v_%0h.jpg" />
<down url="salon_marechaux.tiles/l1_d_%0v_%0h.jpg" />
</level>
</image>

</krpano>


Thanks for you help ! *smile*

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »grandlap« (6. August 2010, 13:20)


2

Freitag, 6. August 2010, 12:20

I had an issue long ago where the hotspot seemed to float around. I added zoom="true" in the XML in the plugin code.

Hope that helps

Jarred

3

Freitag, 6. August 2010, 13:08

Hi,

thanks for your quick answer ! *smile*

Yeah, i tried that, it doesn't work for me.

But, there's something new, when i load the hotspot_ani_black.swf (found in example folder), it just works perfectly with the same embed method.
I just know now where is the problem, but not how to solve it ^^

any other clue ?

Marc

4

Freitag, 6. August 2010, 13:19

[resolved] hotpost position

Hop !

Ok I think i got it. The position of the hotspot certainly depends on LoaderInfo dimensions of the loaded swf.
My hotspot swf export dimension was something like 500x400. When I change it to 10x10 (wich is the size of my magnificent red circle) everything's ok ! *thumbsup*

Thanks again !

5

Freitag, 6. August 2010, 15:53

Kind of funny. That actually was the other issue I had with my hotspot long ago. I guess I should have just pointed to the original thread. My spot was in the top left corner of the stage with plenty of free space to the right and below.

Glad you got it worked out.

6

Freitag, 29. Juli 2011, 19:07

Kind of funny. That actually was the other issue I had with my hotspot long ago. I guess I should have just pointed to the original thread. My spot was in the top left corner of the stage with plenty of free space to the right and below.

Glad you got it worked out.


same issue here. on my ipad, the spots stay in the top left corner... why is that?

7

Freitag, 29. Juli 2011, 20:30

edit: Can you show your hotspot and the code calling it?

8

Freitag, 29. Juli 2011, 20:38

Here it is:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<hotspot name="interior2"
		 url="hotspotIN.png"
		 keep="false"
		 devices="all"
		 visible="true"
		 enabled="true"
		 handcursor="true"
		 ath="20.0" atv="10.0"
		 edge="center"
		 zoom="false"
		 distorted="false" rx="0.0" ry="0.0" rz="0.0"
		 width="100" height="100"
		 scale="1.0"
		 rotate="0.0"
		 alpha="0.80"
		 onclick="loadNave01();"
	/>
	
	<action name="loadNave01">
		loadpano(nave01_mobile.xml);
	</action>	

9

Freitag, 29. Juli 2011, 21:04

I copied the code, made a 50x50 image and named it hotspotIN.png and it works correctly for me. While the 50x50 pix is quite small, it was just to test your code. Check your image to see if you may need to crop it or something. Does it stay in that location while you are moving around in the pano ?

10

Freitag, 29. Juli 2011, 21:22

In the swf it stays where I tell it to, but on the ipad it just goes nuts, and stays in the top left corner when visible in the panorama... I scaled it, but it does exactly the same *unsure*