Forums  

Go Back   Forums > Talk > General FPP Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2008, 03:32 AM
Aifos's Avatar
Aifos Aifos is offline
Senior Member
 
Join Date: Aug 2007
Location: Rosario - Argentina
Posts: 249
Downloads: 0
Uploads: 0
Default track key pressed - listen keys

Hi!
does anybody knows how to call actions when any key is pressed, not just directions keys.
I mean, if i press letter M i want a "Map" to be displayed.

i need this for a project... is it posible to do it with FPP (don?t think so)
is it posible to develople a plug in with that function?
if plugins Gurus arround here may consider this a good functionality to develope , i will appreciate that!

or Denis may consider this as a feature?

think this could be good for people with Disabilities

bye!
__________________
aifos
www.ciudadesferica.com
Follow me on Twitter
Reply With Quote
  #2  
Old 04-15-2008, 10:09 PM
zleifr's Avatar
zleifr zleifr is offline
Senior Member
 
Join Date: May 2007
Posts: 609
Downloads: 0
Uploads: 0
Default

You'd have to do it with a plugin. Almost all the relevant code is already floating around the forum. You'd just need the "standard" plugin structure and add a KeyboardEvent event listener, and a handler function that checks which key has been pressed and directs execution to the proper place.

Zephyr
__________________
Zephyr Renner - AdvancedVirtualTours.com - zleifr @t yahoo

Improving the panoramic one mighty fine plug-in at a time: http://www.flashpanos.com
Reply With Quote
  #3  
Old 07-03-2008, 05:58 PM
Aifos's Avatar
Aifos Aifos is offline
Senior Member
 
Join Date: Aug 2007
Location: Rosario - Argentina
Posts: 249
Downloads: 0
Uploads: 0
Default

Hi all!
i?m still working in this plugin wich needs to listen a keyboard event and do something...
i need that when i press key "a" (or anyone), the autorrotator plugin be disable.

So, i followed Zleifr tutorial for making a plugin and also asked him by mail about this plugin i?m trying to make [thank you so much Zleifr for all you contributions] but i still cannot figure out what?s going on... i didn?t want to bother Zleifr again...

This is what he has writen on his answer:
Quote:
To communicate between plugins, you will use something like this:

In plugin 1:
hotspots.execute("externals.plugin2.disable=1");

Or in plugin 2:
hotspots.execute("externals.plugin1.disable=1");

This will send the command to the hotspots plugin's execute function, and from there it will be sent to the other plugin. It will be received in the setAttribute function, so you will need to watch for a message with name=="disable" and if the value=="1" then you will need to execute whatever code is necessary to disable the plugin.

Zephyr
and this:
Quote:
That won't work fullscreen (flash security restriction), just so you know.

I attached some code from PanoSalado that illustrates using a keyboard event (amongst other things). So all you need to do after the keyboard event is set up is use:
hotspots.execute("external.autorotator.disable=1") ; (or whatever the FPP command is to disable the autorotator

Zephyr
so with this said, i tryed doing the following: i included to the basic plugin structure provided by Zleifr, the function that listens keyevent and if key "a" is pressed, this is the action: hotspots.execute("external.autorotator.disable=1")

here are te codes:

Code:
// this function is called by the timer when hotspots.swf is loaded and defines the hotspots variable:
function waitHotspots (event:Event) {
        if (panoController.externals.hotspots!=null) {
                // wait for XML parsing
                if (panoController.externals.hotspots.ready) {
                        waitTimer.stop();
                        waitTimer = null
                        hotspots = panoController.externals.hotspots;
                        // this is a good place to call a function of your own that starts doing whatever your plugin should do.

hotspots.stage.addEventListener( KeyboardEvent.KEY_DOWN, keylistener, false, 100, true );

function keylistener(event:KeyboardEvent):void
{
    if (event.keyCode==65){

    hotspots.execute("external.autorotator.disable=1");
    
    }
}

                }
        }
}

i wonder if somebody can figure out what is going on... i think it should be working, but i don?t know why it doesn?t!...
i?d really appreciate somebody helps me with this,

many thanks
__________________
aifos
www.ciudadesferica.com
Follow me on Twitter
Reply With Quote
  #4  
Old 07-03-2008, 07:24 PM
cheathamlane cheathamlane is offline
Senior Member
 
Join Date: Mar 2007
Location: California, USA
Posts: 773
Downloads: 0
Uploads: 0
Default

Aifos:

First question: does it work if, say, you put the event listener on one of your FPP hotspots (so that when the hotspot is clicked it does your function)?

If so, then it is working, almost.

What if you try this?:

Code:
// this function is called by the timer when hotspots.swf is loaded and defines the hotspots variable:
function waitHotspots (event:Event) {
        if (panoController.externals.hotspots!=null) {
                // wait for XML parsing
                if (panoController.externals.hotspots.ready) {
                        waitTimer.stop();
                        waitTimer = null
                        hotspots = panoController.externals.hotspots;
                        // this is a good place to call a function of your own that starts doing whatever your plugin should do.

hotspots.stage.addEventListener( KeyboardEvent.KEY_DOWN, keylistener, false, 100, true );
                }
        }
}
//
function keylistener(event:KeyboardEvent):void
{
    if (event.keyCode==65){

    hotspots.execute("external.autorotator.disable=1");
    
    }
}
__________________
Patrick
http://patrickcheatham.com
Reply With Quote
  #5  
Old 07-03-2008, 10:14 PM
Aifos's Avatar
Aifos Aifos is offline
Senior Member
 
Join Date: Aug 2007
Location: Rosario - Argentina
Posts: 249
Downloads: 0
Uploads: 0
Default

hi Patrick
thanks for reply!

if i put in a hotspot: onclick="external.autorotator.disable=1"
of course, it works... if that is what you mean.

i also tryed to put my function out of the waitHotspots function... doesn?t work.

thanks again!!! =)
__________________
aifos
www.ciudadesferica.com
Follow me on Twitter
Reply With Quote
  #6  
Old 07-03-2008, 11:51 PM
Aifos's Avatar
Aifos Aifos is offline
Senior Member
 
Join Date: Aug 2007
Location: Rosario - Argentina
Posts: 249
Downloads: 0
Uploads: 0
Default

hey!!! it is solved!!!! =)
i wrote the function worng!!! there was a "d" missing

"external.autorotator.disabled=1"

it is working perfect!!!1

thanks Zleifr and Patrick!

i hope this can help somebody else =)

i love thi forum!
__________________
aifos
www.ciudadesferica.com
Follow me on Twitter
Reply With Quote
  #7  
Old 05-09-2011, 02:09 PM
fritsjan fritsjan is offline
Junior Member
 
Join Date: Apr 2007
Posts: 28
Downloads: 3
Uploads: 0
Default

Hi Aifos/Patrick,

I am trying to get this to work too. I have it working, but somehow it stops working when in fullscreen mode. When going back too normal mode it works again.

has this something to do with the hotspots.stage.addEventListener ?
Or with the hotspots not accessible in fullscreen?

Does your plugin works in fullscreen mode? If so can you send me the code so I can figure out what is different with mine?

Thanks in advance...

Frits Jan
Reply With Quote
  #8  
Old 05-09-2011, 08:00 PM
Trausti Hraunfjord's Avatar
Trausti Hraunfjord Trausti Hraunfjord is offline
Administrator
 
Join Date: Dec 2007
Location: Icelander in Peru(dise)
Posts: 1,563
Downloads: 1
Uploads: 0
Send a message via Skype™ to Trausti Hraunfjord
Default

Fullscreen is off limits for many things... such as keyboard keys. This is due to Adobe Security concerns, and can not be circumvented.
__________________
Trausti Hraunfjord
Flashificator, the GUI for FPP.
Win-Mac compatible.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 08:57 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.