Hi,

 

This is an issue that I have also had to deal with recently.

 

I had limited success using code similar to that which you have outlined below. The major problem is that pressing CTRL + the majority of keys causes the browser to intercept these key presses and perform its own actions. Trying ctrl + almost every key on the keyboard resulted in only getting about 6 or so CTRL + key combinations being made available to me. Trying ALT + key was even less successful as the flash player just seemed to loose focus entirely, with the browser menu then being given focus.

 

Has anybody else had any success with key board shortcuts? At first glance, it doesn’t seem to be possible to provide logical keyboard navigation on forms with more than a handful of controls. Of course, tab navigation is still possible.

 


From: Abdul Qabiz [mailto:[EMAIL PROTECTED]
Sent: 03 March 2005 16:19
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] newbie

 

Hi,

1) Yeah, you can trap the keyboard events using ActionScript. You can use
"keyDown" event with Key object tofind about pressed keys.. See example
code later in the mail.

2) you can use the combination of mouseDown, mouseMove & mouseUp event to
make dragging happen. Look at Manish's Google map example, see how he is
dragging...

http://manish.revise.org/archives/2005/02/12/no-more-xml-from-google-maps/





##ShortCutKeyExample.mxml###

<?xml version="1.0"?>
<!-- Simple example to demonstrate the TabNavigator layout -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%"
height="100%" backgroundColor="#FFFFFF" initialize="onAppInit();">
<mx:Script>
     <![CDATA[
    var shortcutManager;
   
    function onAppInit()
    {
        shortcutManager = new Object();
        shortcutManager.owner = this;
        shortcutManager.>
handleKeyEvent);
        Key.addListener(shortcutManager);
       
    }
   
    function handleKeyEvent(event)
    {
    
       
        var bCTRLDown = Key.isDown(17); //17 is keycode of CTRL key
       
       
        if(bCTRLDown) {
            if(Key.getCode() == 84) {
                 tb.selectedIndex = 1;
            }else if(Key.getCode() == 69) {
                tb.selectedIndex = 0;
            }
        }                 
    }
   
   
       
       
   
    ]]>
</mx:Script>

    <mx:Panel title="Tab Navigator Panel" width="100%" height="100%">

        <mx:TabNavigator id="tb" borderStyle="solid" width="100%"
height="100%">

            <mx:Canvas label="Canvas 1 (CTRL + E)" width="100%"
height="100%" backgroundColor="#FFFFCC">
                <mx:Label text="Add components here" fontSize="20"
fontStyle="italic"
                    fontWeight="bold" fontFamily="Times New Roman"/>

          </mx:Canvas>

            <mx:Canvas label="Canvas 2 (CTRL + T)" width="100%"
height="100%" backgroundColor="#99CCFF">
                <mx:Label text="Add components here"  fontSize="20"
fontStyle="italic"
                    fontWeight="bold" fontFamily="Times New Roman"/>
            </mx:Canvas>

        </mx:TabNavigator>

    </mx:Panel>

</mx:Application>


-abdul




-----Original Message-----
From: Doodi, Hari - BLS CTR [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 03, 2005 8:29 PM
To: 'flexcoders@yahoogroups.com'
Subject: [flexcoders] newbie

Hi members,
     
      I am new to Flex coding. I did learn a lot from coenraets web site
and also from richinternetapps.com. I do really appreciate them for letting
others to see their code and learn from it.

I do have couple of issues to resolve. I didtry search on Livedocs and
other websites for solutions but didn't findany.

1)      Can any one programmed hotkeys(keyboard shotcuts) in flex ? for
example, instead of using mouse to click on tab of TabNavigator container
users can use keyboard shortcuts say Ctrl+T or Alt+T something like this.
There will be a problem using Alt as accesskey because Alt key has been used
for windows hotkeys. Please help.

2)      My user requires that they should be able to zoom a scanned image
and then move/drag that image. I did accomplished zooming part but unable to
drag the image. Here is the mxml file for your ref.....

      <<manageSchedule_3.mxml>>
Thanks in advance.

Thanks!
Hari




Yahoo! Groups Links






Reply via email to