[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

ctrl in IE

Right i need to know is it possible to use the ctrl key as part of a key combination , Ctrl + P for example, when a flash movie is loaded into IE. I know all about Keydown and all that stuff

The problem is IE regeristering the key press and its short cut to print the page

How do i disable the IE shortcuts or interpurt them before going to IE

this is a big one please help
0
jockmahon01
Asked:
jockmahon01
  • 4
  • 3
1 Solution
 
Aneesh ChopraCommented:
yes, it is possible,
following code will do the trick:

//-----------------------
var keyListener = new Object();
keyListener.onKeyUp = function() {
      if (Key.isDown(Key.CONTROL) && Key.getCode() == 80) {
            // 80 is the keycode for P
            trace("CTRL+P pressed");
      }
};
Key.addListener(keyListener);
//----------------

IMPORTANT: To test above code in Flash authoring environment you must have to select  "Disabled Keyboard Shortcuts"  menu item in Options menu on Compiled SWF window
0
 
jockmahon01Author Commented:
I know of this code, Have u deployed this to a html/cfm file and browsed to it in IE , because i think ull find that ctrl + P will open the print dialog
0
 
Aneesh ChopraCommented:
if SWF in html has the focus then CTRL+P will trigger the actionscript code..

to test it, click on SWF first then press CTRL+P
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jockmahon01Author Commented:
Incorrect, CTRL+P still invokes the print dialog, if u wan to upload an example to prove ur case i will have a look
0
 
Aneesh ChopraCommented:
sorry,
I agree, Flash can't overide Browser default PRINT shortcut key..

but yes, you can use CTRL+ <any unassigned key> with in flash and it will work fine..
0
 
jockmahon01Author Commented:

i also agree with this, the problem with that however is as soon as mircosoft release a new version of IE with new shortcuts ur application could suddenly and overnight be in big problems


What i have discovered for all thoes who struggle with this problem is that you can get the above code to work ie Ctrl+ P to work in a browser.
If u specify to ur users that they must press shitf as well then IE wont pick up the ctrl+p but flash will

so

set up a key listener

            keyListener = new Object();
      keyListener.onKeyDown = Delegate.create(this, keyDownListener);
      Key.addListener(keyListener);


private function keyDownListener():Void
{
      if( (Key.getCode() == 80 ) && ( Key.isDown(Key.CONTROL) )   )
      {
                        trace("Im executing");
            return;
      }
}


if the user presses Shift+ctrl+p then IE will NOT open the print dialog but flash will execute this code
Its not the best solution in the world but the only one i can come up with
                  
0
 
blue-genieCommented:
i remember a number of years ago, this was an issue, and some keys just can't be caught, like the F keys. and a client demanded it, and i had to tell them no can do - also had to convince them to accept a different sequence.
0
 
jockmahon01Author Commented:
one way around this is to include shift, so ctrl + shift + p. With shift pressed ie is intelligent enough to know that ur not pressing ctrl + p and doesnt open the print dialog, flash is not and will kick off what ever u coded to happen with ctrl and p down
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now