Add key listener at applicationComplete not creationComplete, chances
that it will work.

Anand

On Sep 5, 2:39 pm, satish <[EMAIL PROTECTED]> wrote:
> Stil i am not getting , it's bugging me a lot , please some one help
> me this .
>
> On Aug 22, 3:05 pm, "Kundan Singh" <[EMAIL PROTECTED]> wrote:
>
> > hi
> > I have modified the code:-
>
> > it will work, plz check it
>
> > let say (test.mxml) is ur application .
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="absolute" creationComplete="callScript()" >
> > <mx:Script>
> >        <![CDATA[
> >                import mx.controls.Alert;
> >            public function callScript():void
> >     {
> >      ExternalInterface.addCallback("initFunct",init);
> >      ExternalInterface.call("toActionscript");
> >     }
> >                public function init():void
> >                {
> >                  this.setFocus();
> >                     this.addEventListener(KeyboardEvent.KEY_DOWN,ddd);
> >                }
> >                public function ddd(event:KeyboardEvent):void
> >                {
> >                        Alert.show(event.toString());
> >                }
> >        ]]>
> > </mx:Script>
> >    <mx:Button label="click" id="bt"/>
>
> > </mx:Application>
>
> > and add the following code in the index.html.templete inside the script tag
>
> > function thisMovie(movieName) {
>
> > if (navigator.appName.indexOf("Microsoft") != -1) {
>
> > return window[movieName];
>
> > } else {
>
> > return document[movieName];
>
> > }
> > }
>
> > function toActionscript(){
>
> > thisMovie("test").initFunct();
>
> > document.getElementById("test").focus();
>
> > }
>
> > regards
> > kundan singh
>
> > On Thu, Aug 21, 2008 at 6:09 PM, xelf <[EMAIL PROTECTED]> wrote:
>
> > > Hi Sathish,
> > > I am unable to give to the exact solution but the problem here is,
> > > we need to click on the SWF its not needed a button. If you place a
> > > textinput set focus to it inside init(), then click, now the cursor
> > > will be in text input and now keyboard events will work.
>
> > > I think first we need to set the focus in our flex application, then
> > > only the Keyboard events will be catched.
>
> > > I may be wrong but I think this help you to get saome way to find
> > > solution. I will also try to find and update you.
>
> > > regards,
> > > Sam
>
> > > On Aug 21, 12:28 pm, satish <[EMAIL PROTECTED]> wrote:
> > > > Hi ,
>
> > > > Please see the below code . The key board event is not catching untill
> > > > we click the button.
>
> > > > First i tried the below code with out the button , When i hit any key
> > > > in the key board , the application is not catching the key board
> > > > event.
>
> > > > But for my surprise , If i have a button and in the below code and i
> > > > run the applictation , atleast i should click the button once , After
> > > > which when ever i hit the keyboard keys the application is catching
> > > > and alert message is displayed .
>
> > > > Please help me to solve this , Beacuse the application i am working
> > > > is have navigation buttons left and buttons , The left and right key
> > > > events are not catching , if i atleast press one button then , the key
> > > > board events are catching.
>
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > > > layout="absolute" creationComplete="init()">
> > > > <mx:Script>
> > > >         <![CDATA[
> > > >                 import mx.controls.Alert;
> > > >                 public function init():void
> > > >                 {
>
> > > this.addEventListener(KeyboardEvent.KEY_DOWN,ddd);
> > > >                 }
>
> > > >                 public function ddd(event:KeyboardEvent):void
> > > >                 {
> > > >                         Alert.show(event.toString());
> > > >                 }
> > > >         ]]>
> > > > </mx:Script>
> > > >         <mx:Button label="click">
>
> > > >         </mx:Button>
> > > > </mx:Application>
>
> > > > Thanks,
> > > > Satish
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to