Topic: How to enable new keys in autoviewer (via actionscript)

Hi everybody, I couldn't even find post similar to what I'm looking for, so here's my question:
I'd love to enable a couple of new keyboard shortcuts in my autoviewer gallery (i.e. the Esc key) and after a bit of searching I found the following lines inside

    private function onKeyDown() {    
        if(Key.isDown(Key.LEFT)) {
        }else if(Key.isDown(Key.RIGHT)) {
        }else if(Key.isDown(Key.HOME)) {
        }else if(Key.isDown(Key.END)) {
        }else if(Key.isDown(Key.SPACE)) {

I'm assuming that adding a similar line for the Esc key would enable it after I publish my gallery, but what I'm really looking for is a way to pass this setting to the compiled swf via HTML or javascript (my gallery runs inside a JS object).
I guess I could add something in my JS plugin this way (screenshot) but I don't know what/how.
Any ideas on how I could do this? HTML workarounds are welcome too.
Thank you.

Last edited by Fraxav (2010-11-30 13:24:46)

Re: How to enable new keys in autoviewer (via actionscript)

Ok let's forget about the previous question, I think it's better to work with the actsionscipt itself.
So, I'm embedding my index.html inside a JS object. This object is closed when you press the 'esc' key. But giving the focus to the swf (i.e. clicking on the gallery area) would reconfigure the keys and disable the escape button.
So I added this line to the private functions mentioned above

else if(Key.isDown(Key.ESCAPE)) {fscommand("quit");}

but it doesn't work. I tried adding

import flash.system.fscommand;

at the top of the file, but still not working.
I'd really appreciate a piece of advice from you.

Re: How to enable new keys in autoviewer (via actionscript)

How are you testing the functionality? Are you just playing it in Adobe Flash Pro or are you opening the swf or page? I don't think it will work if you are just playing the movie in Flash Pro.

Also please be aware that we can not support modification of the source code.

Mike Richards
SimpleViewer Support Team.

Re: How to enable new keys in autoviewer (via actionscript)

I'm uploading the new swf and testing it directly online on my web page. And similar modifications (which I used as controls) worked fine. I understand you can't solve all the problems involving customization.
I'm hoping someone can give me a couple of tips. The code I posted is kinda the solution already. Maybe I'm adding it in the wrong place?
A doubt: that command is said to close "the projector" (which is the swf, I'm guessing). But my swf is inside the index.html, which is opened inside a javascript shadowbox. So what I'm really trying to do is to close the shadowbox!
I should use completely different code for that, right?

Re: How to enable new keys in autoviewer (via actionscript)

If you are trying to close shadowbox you should use external interface to call the shadowbox function that closes the shadowbox window.

Mike Richards
SimpleViewer Support Team.