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.

milotimbol

Fortgeschrittener

Beiträge: 229

Wohnort: Philippines

Beruf: Software Developer

  • Nachricht senden

21

Dienstag, 13. Juli 2010, 02:17

it works! thanks! but I can't turn it back on. When the pano loads the mouse follow is on, when I click off it is disabled(or removed) but when I click on again it no longer adds the plugin. Any ideas?

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
	<plugin name="mouseFollowOnBtn" url="mouse-follow-on.png" alpha="0.9" visible="false" align="lefttop" edge="lefttop" y="-4" x="852" blendmode="normal" keep="true" onclick="action(mouseFollowOn);"/>
	<plugin name="mouseFollowOffBtn" url="mouse-follow-off.png" alpha="0.9" visible="true" align="lefttop" edge="lefttop" y="-4" x="852" blendmode="normal" keep="true" onclick="action(mouseFollowOff);"/>

	<action name="mouseFollowOn">
		addplugin(mousefollow);
		set(plugin[mousefollow].enabled, true);
		set(plugin[mouseFollowOffBtn].visible, true);
		set(plugin[mouseFollowOnBtn].visible, false);
	</action>	
	
	<action name="mouseFollowOff">
		set(plugin[mouseFollowOffBtn].visible, false);
		set(plugin[mouseFollowOnBtn].visible, true);
		removeplugin(mousefollow);
		set(hlookat_moveforce, 0);
		set(vlookat_moveforce, 0);

	</action>

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

22

Dienstag, 13. Juli 2010, 08:06

No sorry no clue :(

adding the plugin again should alsoo add the eventlisteners again. Maybe instead of removing the plugin you could alsoo bind an function with an action.

This updated code, doesnt start the plugin when its loaded, but when you call it by plugin[mousefollow].startit() en you stop it with stopit()
Not tested though.

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package
{
    import flash.display.Sprite;
    import flash.events.Event;

    import krpano_as3_interface;


    public class followmouse extends Sprite
    {
        private var krpano : krpano_as3_interface = null;

        private var control_mousetype_backup:String = null;
		private var pluginpath : String = null;
		private var pluginobj  : Object = null;
		
        public function followmouse()
        {
            if (stage == null)
            {
                this.addEventListener(Event.ADDED_TO_STAGE, startplugin);
                this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);
            }
        }

        private function startplugin(evt:Event):void
        {
            krpano = krpano_as3_interface.getInstance();
			
			//register actions to flash functions
			pluginpath = evt.data;							
        	pluginobj  = krpano.get(pluginpath);
			krpano.set(pluginpath+".stopit", startListening);
			krpano.set(pluginpath+".startit", stopListening);
			
            if ( krpano.get("version") < "1.0.7" )
            {
                krpano.call("error(followmouse plugin - wrong krpano version! 1.0.7 or higher needed);");
                return;
            }

            // save current control mode
            control_mousetype_backup = krpano.get("control.mousetype");
            
            // disable default mouse control
            krpano.set("control.mousetype", "off");

            // add frame listener -- DISABLED SO YOU CAN MANUALLY CALL IT
            //addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }
        private function stopListening():void
		{
			 stopplugin(null);
		}
		private function startListening():void
		{
			 addEventListener(Event.ENTER_FRAME, enterFrameHandler);
		}
        private function stopplugin(evt:Event):void
        {
            // remove frame listener
            removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
                    
            // restore old controlmode
            krpano.set("control.mousetype", control_mousetype_backup);
        }

        private function enterFrameHandler(event:Event):void
        {
            var mx:Number = stage.mouseX;
            var my:Number = stage.mouseY;
            var sx:Number = stage.stageWidth  * 0.5;
            var sy:Number = stage.stageHeight * 0.5;

            // calc motion vectors: -1.0 to +1.0
            var vx:Number = (mx - sx) / sx;
            var vy:Number = (my - sy) / sy;

            // advance it a little bit:
            // - make moving slower in the middle
            // - and faster in the outer regions
            vx = (vx < 0 ? -1.0 : +1.0) * Math.pow(Math.abs(vx), 2.0);
            vy = (vy < 0 ? -1.0 : +1.0) * Math.pow(Math.abs(vy), 2.0);
            
            // stop very slow moving
            if (Math.abs(vx) < 0.01)    vx = 0;
            if (Math.abs(vy) < 0.01)    vy = 0;

            // set move forces
            krpano.set("hlookat_moveforce", vx);
            krpano.set("vlookat_moveforce", vy);
        }
    }
}

23

Dienstag, 26. Oktober 2010, 12:57

Where do I paste this code for working "area"? Trying to paste into the html file:

Quellcode

1
var swf = createswf("krpano.swf", "krpanoSWFObject", "100%", "100%");var area:Object = krpano.get("area");  var mx:Number = stage.mouseX * 0.5;  var my:Number = stage.mouseY * 0.5;  var sx:Number = area.pixelwidth  * 0.5;  var sy:Number = area.pixelheight * 0.5;  swf.addVariable("xml", "test_area.xml");  swf.addParam("wmode","transparent");  swf.embed("krpanoDIV");




But, unfortunately, does not work at all *confused*

edit: How I can edit this plugin code?
I have:
- followmouse.as
- followmouse.swf

Im totally newbie in flash and i would like to set the area in this plugin. Someone help me? *mellow*

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »d&g« (26. Oktober 2010, 16:23)


Beiträge: 1 100

Wohnort: Angers - France

Beruf: 360 experiences creator

  • Nachricht senden

24

Donnerstag, 22. September 2011, 11:51

Hi, is there a way to use this plugin but only horizontal ?
I don't want to follow the mouse up and down, is it possible ?

Thanx !!!

25

Montag, 26. September 2011, 17:32

Hi,
Hi, is there a way to use this plugin but only horizontal ?
I don't want to follow the mouse up and down, is it possible ?
yes, but only by editing the code,
e.g. remove this line:

Quellcode

1
krpano.set("vlookat_moveforce", vy);
and the vertical movement will be not set,

to compile the .as file to a .swf file you need to download the Flex SDK and adjust the path in the mxmlc_compile.bat to it,

best regards,
Klaus

26

Donnerstag, 28. Juni 2012, 18:40

Solution

Hello, i have a solution to turn on and off this plugin. Here my solution.
She work well on this web site http://www.rauzier-hyperphoto.com/menus-plaisirs/
I give a wrong url adress to setup the mousefollow off.


<plugin name="mousefollow" url="followmouse.swf" visible="false" keep="true" enabled="false" />
<action name="mousefollow-off">
set(vlookat_moveforce,0);
set(hlookat_moveforce,0);
set(plugin[mousefollow].url,followmouseoff.swf);
</action>

<action name="mousefollow-on">
set(plugin[mousefollow].url,followmouse.swf)
</action>

<plugin name="papa-barre" keep="true" align="bottom" x="0" y="0" url="vide.png" width="100%" height="60" onover="mousefollow-off();" onhover="tween(alpha,1); " onout="tween(alpha,0); action(qtvrcursor); mousefollow-on(); " alpha="1" onloaded="" zorder="2"/>

danimorgo

Anfänger

Beiträge: 42

Wohnort: argentina

Beruf: diseñador

  • Nachricht senden

27

Freitag, 21. März 2014, 20:38

question

is possible to control the acceleration and friction of the mouse?

28

Freitag, 28. März 2014, 08:57

is possible to control the acceleration and friction of the mouse?
Hi,

yes, the *_moveforce settings are basically used by keyboard control - therefore the keyboard related control settings will affect the movement in this case.

Look here for the keybaccelerate, keybspeed and keybfriction settings:
http://krpano.com/docu/xml/#control.advanced

Best regards,
Klaus

29

Donnerstag, 3. März 2016, 20:41

HTML5 Version

I rewrote this for HTML5 if anyone wants it:

https://github.com/BOXNYC/krpano-plugins…/followmouse.js

Cheers!

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »BOX« (4. März 2016, 01:39)


herrpedro

Fortgeschrittener

Beiträge: 193

Wohnort: Lisbon

Beruf: Programmer/analyst

  • Nachricht senden

30

Donnerstag, 27. September 2018, 22:32

I rewrote this for HTML5 if anyone wants it:

https://github.com/BOXNYC/krpano-plugins…/followmouse.js

Cheers!



thank you!

31

Dienstag, 3. August 2021, 01:36

is there a new way to do that ?

and is it possible to have autorotate enabled at the same time ? :p
+ limit the max X / Y
just to show it's interactive like this example

32

Dienstag, 3. August 2021, 08:38

i made a new plugin for it lately.

you can adjust the sensitivity ofc... what do you mean with max X/Y ?

33

Dienstag, 3. August 2021, 16:47

i made a new plugin for it lately.

you can adjust the sensitivity ofc... what do you mean with max X/Y ?
do you have a link ? ^^

34

Mittwoch, 4. August 2021, 18:57

do you have a link ? ^^


no, its not public, and i need to switch from shareit as well, first.
but it works with autorotate, no problem

35

Dienstag, 21. September 2021, 11:47

enable/disable followmouse.xml

How do I enable/disable the followmouse feature that is shown in the examples?
https://krpano.com/viewsource.html?relea…followmouse.xml

Thanks

Ähnliche Themen