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, 9. Oktober 2009, 23:18

[solved] Making .swf hotspots by hand?

Hello,

I am trying to make an .swf hotspots. If I do it in Adobe Flash CS3 and export to .sfw, everything works as expected. But if I try creating a hotspot .swf from scratch, I have a very odd behavior. Here's how I am doing it:

1. I have a Test.as file:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
package {
 	import flash.display.Sprite;
 	public class Test extends Sprite {
      	public function Test() {
           	init();
      	}
      	private function init():void {
           	graphics.beginFill(0xff0000);
           	graphics.drawEllipse(50,50,50,50);
           	graphics.endFill();
      	}
 	}
}

Basically, it draws a red circle.

2. I am compiling it with mxmlc from free flex_sdk and have my Test.swf, which I use as a hotspot:

Quellcode

1
<hotspot name="hotspot1" url="Test.swf" ath="0" atv="0" />


3. I can see my red circle in the panorama, but it is positioned not at 0,0 location. And, if I zoom in, this circle has a tendency to move from left to right and a bit down. Zooming out moves it leftwards. Do you guys have a sample .as plugin so I can have a look how it is done? I am not a flash developer per se, but this one should be simple, right?

Thank you.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »nmakarov« (14. Oktober 2009, 02:51)


2

Samstag, 10. Oktober 2009, 00:27

Try adding zoom="true" to the hotspot.

<hotspot name="hotspot1" url="Test.swf" ath="0" atv="0" zoom="true" />

Also try to open your Test.swf file and see if it is centered on the stage. I encountered both problems when I made my first hotspot. Of course, I used flash and not the manual code so I can't help you fix it but hopefully this will give you some assistance with the zoom issue.

3

Samstag, 10. Oktober 2009, 00:53

if I set zoom="true", it stays at the spot on zoom. Cool. But I do not want my hotspots to be zoomable. When I open the .swf in a browser, it is not centered, so you're right. But I do not know how to place it in the center...

4

Dienstag, 13. Oktober 2009, 09:57

Hi,

you need to draw it at the center (at 0/0)

Quellcode

1
graphics.drawEllipse(0,0,50,50);


or center your graphic after drawing:

Quellcode

1
2
this.x = -this.width / 2.0;
this.y = -this.height / 2.0;


best regards,
Klaus

5

Mittwoch, 14. Oktober 2009, 00:11

Still doesn't work...

Here's the full code:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package {
 	import flash.display.Sprite;
      	public class Circle extends Sprite {
      	public function Circle() {
           	init();
      	}
      	private function init():void {
           	graphics.beginFill(0xff0000);
           	graphics.drawEllipse(0,0,50,50);
           	graphics.endFill();
           	this.x = -this.width / 2.0;
           	this.y = -this.height / 2.0;
      	}
 	}
}


I have even combined both tecniques... Still the same effect...
Klaus, can you post here a full .as example (as simple as this stupid red circle) so it will stay at the damn spot, so I can compile it with mxmlc and see that it actually stays, please? I'm loosing my hairs over it. I know I am asking just too much, but I do not have many of my hair left, either :-)

6

Mittwoch, 14. Oktober 2009, 00:15

Have you cleared your browser cache after each attempt?

7

Mittwoch, 14. Oktober 2009, 00:27

Have you cleared your browser cache after each attempt?
Yes, I did. I even created a new .as hotspot (just in to be sure), compiled it and everything. The same flying dutchman effect. Help!!! Just give me a complete .as example and I will stop crying.

8

Mittwoch, 14. Oktober 2009, 02:50

In order to save my hair (whatever is left, at least), I spend last two hours in research and finally found the solution. Klaus, there was no need to center the image! The problem was with the canvas size. By default it was something like 800x600, so my circle was in the upper left corner. That's why it moved sideways if I looked straight at the circle. The only line I needed to include in my .as file is

Quellcode

1
[SWF(width="50", height="50")]


immediately before the class declaration.

9

Samstag, 17. Oktober 2009, 22:19

Hi,

sorry, you're absolutely right
(I don't know where my mind was... )

best regards,
Klaus

Ähnliche Themen