You can try using below codes. Thanks.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"
     creationComplete="creationCompleteHandler(event)">
     <mx:Script>
         <![CDATA[
             import flash.display.Sprite;
             import flash.events.*;
             import flash.net.FileReference;
             import flash.net.URLRequest;
             import flash.net.FileFilter;

             private var dispatcher:FileReference = new FileReference();

             private function creationCompleteHandler(event:Event):void
             {
                 dispatcher.addEventListener(Event.CANCEL,
cancelHandler);
                 dispatcher.addEventListener(Event.COMPLETE,
completeHandler);
                 dispatcher.addEventListener(IOErrorEvent.IO_ERROR,
ioErrorHandler);
                 dispatcher.addEventListener(Event.OPEN, openHandler);
                 dispatcher.addEventListener(ProgressEvent.PROGRESS,
progressHandler);
                
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
                 dispatcher.addEventListener(Event.SELECT,
selectHandler);

             }

              private function cancelHandler(event:Event):void {
                     trace("cancelHandler: " + event);
                     btn.setFocus();
             }
             private function completeHandler(event:Event):void {
                 trace("completeHandler: " + event);
                 btn.setFocus();
             }
             private function
uploadCompleteDataHandler(event:DataEvent):void {
                 trace("uploadCompleteData: " + event);
                 btn.setFocus();
             }
             private function
httpStatusHandler(event:HTTPStatusEvent):void {
                 trace("httpStatusHandler: " + event);
                 btn.setFocus();
             }

             private function ioErrorHandler(event:IOErrorEvent):void {
                 trace("ioErrorHandler: " + event);
                 btn.setFocus();
             }
             private function openHandler(event:Event):void {
                 trace("openHandler: " + event);
                 btn.setFocus();
             }
             private function progressHandler(event:ProgressEvent):void {
                 var file:FileReference = FileReference(event.target);
                 trace("progressHandler name=" + file.name + "
bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
                 btn.setFocus();
             }
             private function
securityErrorHandler(event:SecurityErrorEvent):void {
                 trace("securityErrorHandler: " + event);
                 btn.setFocus();
             }
             private function selectHandler(event:Event):void {
                 btn.setFocus();
             }

             private function importFile(event:Event):void
             {
                 dispatcher.browse();
             }
         ]]>
     </mx:Script>
     <mx:Panel id="panel"
             layout="absolute"
             horizontalCenter="0"
             verticalCenter="0"
             width="500"
             height="300">
         <mx:Image id="img"
                 verticalCenter="0"
                 horizontalCenter="0"
                 maxWidth="200"
                 maxHeight="200" />
         <mx:ControlBar>
             <mx:Button id="btn"
                     label="Browse and preview..."
                     click="importFile(event)" />
             <mx:Button label="Upload..."
                       click="importFile(event)"/>
         </mx:ControlBar>
     </mx:Panel>

</mx:Application>

--- In [email protected], Akshar Kaul <akshar.k...@...> wrote:
>
> can you share your code.
>
> Akshar Kaul
>
>
> On Tue, Aug 10, 2010 at 13:11, chinaloveshisiling <
> chinaloveshisil...@... wrote:
>
> >
> >
> > Tried. Still no effect. And other ideas? :-)
> >
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>,
Akshar
> > Kaul akshar.kaul@ wrote:
> > >
> > > try importButton.setFocus();
> > >
> > > Akshar Kaul
> > >
> > >
> > > On Tue, Aug 10, 2010 at 11:42, chinaloveshisiling <
> > > chinaloveshisiling@ wrote:
> > >
> > > >
> > > >
> > > > Thanks Akshar, I had tried use the method you mentioned. Call
> > > > focusManager.setFocus(importButton); in the function handle for
the
> > > > completion event. But there is no effect.
> > > >
> > > >
> > > > --- In [email protected]
<flexcoders%40yahoogroups.com><flexcoders%
> > 40yahoogroups.com>, Akshar
> >
> > > > Kaul <akshar.kaul@> wrote:
> > > > >
> > > > > you can listen to the completion event of the filereference
and then
> > set
> > > > the
> > > > > focus to whatever component you want.
> > > > >
> > > > > Akshar Kaul
> > > > >
> > > > >
> > > > > On Tue, Aug 10, 2010 at 11:13, chinaloveshisiling <
> > > > > chinaloveshisiling@> wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > When using the keyboard to navigate the UI, focus is lost
after
> > > > > > importing file using FileReference. Who know how to deal
with this
> > > > > > issue? Thanks.
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
>


Reply via email to