RE: [flexcoders] Key class Help
Excellent Abdul, This is what I am look for. Thank you very much for your help. Thanks! Hari -Original Message- From: Abdul Qabiz [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 1:22 AM To: flexcoders@yahoogroups.com; 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Key class Help Hi Hari, What I understand, you want to assign some keyboard shortcuts to each control on screen so that when shortcut key is pressed, control get focussed? You can easily achieve this using Key object, as demonstrated in code later in this mail. I am assuming, - user would press CTRL + 1, CTRL + 2 ...to focus a control on screen. - user can press SPACE key to execute associated action with the controls like Button, CheckBox, RadioButton or any button kind of component. - user can use arrow keys to change values in list type of controls like ComboBox - user can type in textfield like control Following example has some controls on screen and pressing CTRL + 1 .. CTRL + 5 shifts the focus to corresponding control I would like to help you my best so that you are successful in creating a very accessible Flex app. Please run it to find out more.. Following code is quick dirty demo, you can always write a ShortcutManager class which is more easier to use and managable... ###KeyObjectDemo.mxml### ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=initApp() mx:Script ![CDATA[ var keyListener:Object; function debugTrace(msg) { _ta.text+= msg + newline; } function initApp() { keyListener = new Object(); keyListener.onKeyDown = mx.utils.Delegate.create(this, shorcutHandler); Key.addListener(keyListener); } function shorcutHandler() { var bControlPressed:Boolean = Key.isDown(Key.CONTROL); if(bControlPressed) { //CTRL if(Key.isDown(49)) { // 1 debugTrace(CTRL + 1); //set focus to textfield my_input.setFocus(); }else if(Key.isDown(50)) { //2 debugTrace(CTRL + 2); //set focus to button my_btn.setFocus(); // my_btn.dispatchEvent({type:click}); }else if(Key.isDown(51)) { //3 debugTrace(CTRL + 3); my_radio.setFocus(); // my_radio.selected = true; //my_btn.dispatchEvent({type:change}); }else if(Key.isDown(52)) { //4 debugTrace(CTRL + 4); my_check.setFocus(); }else if(Key.isDown(53)) { //5 debugTrace(CTRL + 5); my_combo.setFocus(); } } } ]] /mx:Script mx:TextInput id=my_input focusIn=debugTrace('TextInput focussed') change=debugTrace('TextInput value changed')/ mx:Button label=Button id=my_btn focusIn=debugTrace('Button focussed') click=debugTrace('button pressed')/ mx:RadioButton label=radio id=my_radio focusIn=debugTrace('RadioButton focussed') click=debugTrace('Radio button selected')/ mx:CheckBox label=Checkbox id=my_check focusIn=debugTrace('CheckBox focussed') click=debugTrace('CheckBox change')/ mx:ComboBox id=my_combo focusIn=debugTrace('ComboBox focussed') change=debugTrace('ComboBox selection changed') mx:dataProvider mx:Array mx:StringIndia/mx:String mx:StringUSA/mx:String mx:StringAustralia/mx:String /mx:Array /mx:dataProvider /mx:ComboBox mx:VBox mx:Label text=Debug Info:/ mx:TextArea id=_ta text= width=200 height=200/ /mx:VBox /mx:Application Hope that helps.. -abdul -Original Message- From: Doodi, Hari - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 8:48 PM To: 'flexcoders@yahoogroups.com' Subject: [flexcoders] Key class Help Hi list, I need some help/explanation about Key class. Based on the examples mentioned in the live docs as well as in Action Script Language Reference I created the following mxml files. I want to use the Key class to allow the user use key board to access UI Objects, but no success. Any help appreciated. Keyboard_2.mxml Keyboard_0.mxml Keyboard_1.mxml Thanks! Hari Yahoo! Groups Links Yahoo! Groups Links Yahoo! Groups Links * To visit your group on the web
RE: [flexcoders] Key class Help
Nice to know, it works for you :) Feel free to shoot more queries on the same... -abdul -Original Message- From: Doodi, Hari - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 8:21 PM To: 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Key class Help Excellent Abdul, This is what I am look for. Thank you very much for your help. Thanks! Hari -Original Message- From: Abdul Qabiz [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 1:22 AM To: flexcoders@yahoogroups.com; 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Key class Help Hi Hari, What I understand, you want to assign some keyboard shortcuts to each control on screen so that when shortcut key is pressed, control get focussed? You can easily achieve this using Key object, as demonstrated in code later in this mail. I am assuming, - user would press CTRL + 1, CTRL + 2 ...to focus a control on screen. - user can press SPACE key to execute associated action with the controls like Button, CheckBox, RadioButton or any button kind of component. - user can use arrow keys to change values in list type of controls like ComboBox - user can type in textfield like control Following example has some controls on screen and pressing CTRL + 1 .. CTRL + 5 shifts the focus to corresponding control I would like to help you my best so that you are successful in creating a very accessible Flex app. Please run it to find out more.. Following code is quick dirty demo, you can always write a ShortcutManager class which is more easier to use and managable... ###KeyObjectDemo.mxml### ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=initApp() mx:Script ![CDATA[ var keyListener:Object; function debugTrace(msg) { _ta.text+= msg + newline; } function initApp() { keyListener = new Object(); keyListener.onKeyDown = mx.utils.Delegate.create(this, shorcutHandler); Key.addListener(keyListener); } function shorcutHandler() { var bControlPressed:Boolean = Key.isDown(Key.CONTROL); if(bControlPressed) { //CTRL if(Key.isDown(49)) { // 1 debugTrace(CTRL + 1); //set focus to textfield my_input.setFocus(); }else if(Key.isDown(50)) { //2 debugTrace(CTRL + 2); //set focus to button my_btn.setFocus(); // my_btn.dispatchEvent({type:click}); }else if(Key.isDown(51)) { //3 debugTrace(CTRL + 3); my_radio.setFocus(); // my_radio.selected = true; //my_btn.dispatchEvent({type:change}); }else if(Key.isDown(52)) { //4 debugTrace(CTRL + 4); my_check.setFocus(); }else if(Key.isDown(53)) { //5 debugTrace(CTRL + 5); my_combo.setFocus(); } } } ]] /mx:Script mx:TextInput id=my_input focusIn=debugTrace('TextInput focussed') change=debugTrace('TextInput value changed')/ mx:Button label=Button id=my_btn focusIn=debugTrace('Button focussed') click=debugTrace('button pressed')/ mx:RadioButton label=radio id=my_radio focusIn=debugTrace('RadioButton focussed') click=debugTrace('Radio button selected')/ mx:CheckBox label=Checkbox id=my_check focusIn=debugTrace('CheckBox focussed') click=debugTrace('CheckBox change')/ mx:ComboBox id=my_combo focusIn=debugTrace('ComboBox focussed') change=debugTrace('ComboBox selection changed') mx:dataProvider mx:Array mx:StringIndia/mx:String mx:StringUSA/mx:String mx:StringAustralia/mx:String /mx:Array /mx:dataProvider /mx:ComboBox mx:VBox mx:Label text=Debug Info:/ mx:TextArea id=_ta text= width=200 height=200/ /mx:VBox /mx:Application Hope that helps.. -abdul -Original Message- From: Doodi, Hari - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 8:48 PM To: 'flexcoders@yahoogroups.com' Subject: [flexcoders] Key class Help Hi list, I need some help/explanation about Key class. Based on the examples mentioned in the live docs as well as in Action Script Language Reference I created the following mxml files. I want to use the Key
RE: [flexcoders] Key class Help
Use application instead of _root. - Gordon -Original Message- From: Matt Horn [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 1:30 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Key class Help Another variation on this is to use addEventListener on the keyUp event of _root. Of course, using _root is discouraged, but I haven't been able to figure out an alternative. -begin-- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=initApp() height=500 width=300 mx:Script![CDATA[ function debugTrace(msg){ _ta.text+= msg + newline; } function initApp() { _root.addEventListener(keyUp,mx.utils.Delegate.create(this, keyHandler)); } function keyHandler(event) { debugTrace(Key: + event.code + ( + event.ascii + )); } ]]/mx:Script mx:VBox mx:TextInput id=my_input change=debugTrace('TextInput value changed') / mx:TextArea id=_ta text= width=200 height=200/ /mx:VBox /mx:Application end--- HTH, Matt Horn From: Abdul Qabiz [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 1:22 AM To: flexcoders@yahoogroups.com; 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Key class Help Hi Hari, What I understand, you want to assign some keyboard shortcuts to each control on screen so that when shortcut key is pressed, control get focussed? You can easily achieve this using Key object, as demonstrated in code later in this mail. I am assuming, - user would press CTRL + 1, CTRL + 2 ...to focus a control on screen. - user can press SPACE key to execute associated action with the controls like Button, CheckBox, RadioButton or any button kind of component. - user can use arrow keys to change values in list type of controls like ComboBox - user can type in textfield like control Following example has some controls on screen and pressing CTRL + 1 .. CTRL + 5 shifts the focus to corresponding control I would like to help you my best so that you are successful in creating a very accessible Flex app. Please run it to find out more.. Following code is quick dirty demo, you can always write a ShortcutManager class which is more easier to use and managable... ###KeyObjectDemo.mxml### ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=initApp() mx:Script ![CDATA[ var keyListener:Object; function debugTrace(msg) { _ta.text+= msg + newline; } function initApp() { keyListener = new Object(); keyListener.onKeyDown = mx.utils.Delegate.create(this, shorcutHandler); Key.addListener(keyListener); } function shorcutHandler() { var bControlPressed:Boolean = Key.isDown(Key.CONTROL); if(bControlPressed) { //CTRL if(Key.isDown(49)) { // 1 debugTrace(CTRL + 1); //set focus to textfield my_input.setFocus(); }else if(Key.isDown(50)) { //2 debugTrace(CTRL + 2); //set focus to button my_btn.setFocus(); // my_btn.dispatchEvent({type:click}); }else if(Key.isDown(51)) { //3 debugTrace(CTRL + 3); my_radio.setFocus(); // my_radio.selected = true; //my_btn.dispatchEvent({type:change}); }else if(Key.isDown(52)) { //4 debugTrace(CTRL + 4); my_check.setFocus(); }else if(Key.isDown(53)) { //5 debugTrace(CTRL + 5); my_combo.setFocus
RE: [flexcoders] Key class Help
Yup, brain fart. This works just grand: application.addEventListener("keyUp",mx.utils.Delegate.create(this, keyHandler)); From: Gordon Smith [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 4:38 PMTo: 'flexcoders@yahoogroups.com'Subject: RE: [flexcoders] Key class Help Use application instead of _root.- Gordon-Original Message-From: Matt Horn [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 1:30 PMTo: flexcoders@yahoogroups.comSubject: RE: [flexcoders] Key class HelpAnother variation on this is to use addEventListener on the keyUp eventof _root. Of course, using "_root" is discouraged, but I haven't beenable to figure out an alternative.-begin--?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"initialize="initApp()" height="500" width="300" mx:Script![CDATA[function debugTrace(msg){ _ta.text+= msg + newline;}function initApp() { _root.addEventListener("keyUp",mx.utils.Delegate.create(this,keyHandler));} function keyHandler(event) { debugTrace("Key:" + event.code + "(" + event.ascii + ")");}]]/mx:Scriptmx:VBox mx:TextInput id="my_input" change="debugTrace('TextInput valuechanged')" / mx:TextArea id="_ta" text="" width="200" height="200"//mx:VBox /mx:Applicationend---HTH,Matt Horn____ From: Abdul Qabiz [mailto:[EMAIL PROTECTED] Sent: Friday, April 01, 2005 1:22 AM To: flexcoders@yahoogroups.com; 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] Key class Help Hi Hari, What I understand, you want to assign some keyboard shortcuts toeach control on screen so that when shortcut key is pressed, controlget focussed? You can easily achieve this using Key object, as demonstrated incode later in this mail. I am assuming, - user would press CTRL + 1, CTRL + 2 ...to focus a control onscreen. - user can press SPACE key to execute associated action with thecontrols like Button, CheckBox, RadioButton or any button kind ofcomponent. - user can use arrow keys to change values in list type ofcontrols like ComboBox - user can type in textfield like control Following example has some controls on screen and pressing CTRL+ 1 .. CTRL + 5 shifts the focus to corresponding control I would like to help you my best so that you are successful increating a very accessible Flex app. Please run it to find out more.. Following code is quick dirtydemo, you can always write a ShortcutManager class which is more easier touse and managable... ###KeyObjectDemo.mxml### ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initApp()" mx:Script ![CDATA[ var keyListener:Object; function debugTrace(msg) { _ta.text+= msg + newline; } function initApp() { keyListener = new Object(); keyListener.> shorcutHandler); Key.addListener(keyListener); } function shorcutHandler() { var bControlPressed:Boolean = Key.isDown(Key.CONTROL); if(bControlPressed) { //CTRL if(Key.isDown(49)) { // 1 debugTrace("CTRL + 1"); //set focus to textfield my_input.setFocus(); }else if(Key.isDown(50)) { //2 debugTrace("CTRL + 2"); //set focus to button my_btn.setFocus(); // my_btn.dispatchEvent({type:"click"}); }else if(Key.isDown(51)) { //3 debugTrace("CTRL + 3"); my_radio.setFocus(); // my_radio.selected = true; // my_btn.dispatchEvent({type:"change"}); }else if(Key.isDown(52)) { //4 debugTrace("CTRL + 4"); my_check.setFocus(); }else if(Key.isDown(53)) { //5 debugTrace("CTRL + 5"); my_combo.setFocus(); } } } ]] /mx:Script mx:TextInput id="my_input" focusIn="debugTrace('TextInputfocussed')" change="debugTrace('TextInput value changed')"/ mx:Button label="Button" id="my_btn"focusIn="debugTrace('Button focussed')" click="debugTrace('button pressed')"/ mx:RadioButton label="radio" id="my_radio" focusIn="debugTrace('RadioButton focussed')"click="debugTrace('Radio button selected')"/ mx:CheckBox
[flexcoders] Key class Help
Hi list, I need some help/explanation about Key class. Based on the examples mentioned in the live docs as well as in Action Script Language Reference I created the following mxml files. I want to use the Key class to allow the user use key board to access UI Objects, but no success. Any help appreciated. Keyboard_2.mxml Keyboard_0.mxml Keyboard_1.mxml Thanks! Hari Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ Keyboard_2.mxml Description: Binary data Keyboard_0.mxml Description: Binary data Keyboard_1.mxml Description: Binary data
RE: [flexcoders] Key class Help
Hi Hari, What I understand, you want to assign some keyboard shortcuts to each control on screen so that when shortcut key is pressed, control get focussed? You can easily achieve this using Key object, as demonstrated in code later in this mail. I am assuming, - user would press CTRL + 1, CTRL + 2 ...to focus a control on screen. - user can press SPACE key to execute associated action with the controls like Button, CheckBox, RadioButton or any button kind of component. - user can use arrow keys to change values in list type of controls like ComboBox - user can type in textfield like control Following example has some controls on screen and pressing CTRL + 1 .. CTRL + 5 shifts the focus to corresponding control I would like to help you my best so that you are successful in creating a very accessible Flex app. Please run it to find out more.. Following code is quick dirty demo, you can always write a ShortcutManager class which is more easier to use and managable... ###KeyObjectDemo.mxml### ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=initApp() mx:Script ![CDATA[ var keyListener:Object; function debugTrace(msg) { _ta.text+= msg + newline; } function initApp() { keyListener = new Object(); keyListener.onKeyDown = mx.utils.Delegate.create(this, shorcutHandler); Key.addListener(keyListener); } function shorcutHandler() { var bControlPressed:Boolean = Key.isDown(Key.CONTROL); if(bControlPressed) { //CTRL if(Key.isDown(49)) { // 1 debugTrace(CTRL + 1); //set focus to textfield my_input.setFocus(); }else if(Key.isDown(50)) { //2 debugTrace(CTRL + 2); //set focus to button my_btn.setFocus(); // my_btn.dispatchEvent({type:click}); }else if(Key.isDown(51)) { //3 debugTrace(CTRL + 3); my_radio.setFocus(); // my_radio.selected = true; //my_btn.dispatchEvent({type:change}); }else if(Key.isDown(52)) { //4 debugTrace(CTRL + 4); my_check.setFocus(); }else if(Key.isDown(53)) { //5 debugTrace(CTRL + 5); my_combo.setFocus(); } } } ]] /mx:Script mx:TextInput id=my_input focusIn=debugTrace('TextInput focussed') change=debugTrace('TextInput value changed')/ mx:Button label=Button id=my_btn focusIn=debugTrace('Button focussed') click=debugTrace('button pressed')/ mx:RadioButton label=radio id=my_radio focusIn=debugTrace('RadioButton focussed') click=debugTrace('Radio button selected')/ mx:CheckBox label=Checkbox id=my_check focusIn=debugTrace('CheckBox focussed') click=debugTrace('CheckBox change')/ mx:ComboBox id=my_combo focusIn=debugTrace('ComboBox focussed') change=debugTrace('ComboBox selection changed') mx:dataProvider mx:Array mx:StringIndia/mx:String mx:StringUSA/mx:String mx:StringAustralia/mx:String /mx:Array /mx:dataProvider /mx:ComboBox mx:VBox mx:Label text=Debug Info:/ mx:TextArea id=_ta text= width=200 height=200/ /mx:VBox /mx:Application Hope that helps.. -abdul -Original Message- From: Doodi, Hari - BLS CTR [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 8:48 PM To: 'flexcoders@yahoogroups.com' Subject: [flexcoders] Key class Help Hi list, I need some help/explanation about Key class. Based on the examples mentioned in the live docs as well as in Action Script Language Reference I created the following mxml files. I want to use the Key class to allow the user use key board to access UI Objects, but no success. Any help appreciated. Keyboard_2.mxml Keyboard_0.mxml Keyboard_1.mxml Thanks! Hari Yahoo! Groups Links Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/