[Laszlo-user] giving an OL Flash app focus

Cary Clark caclark at cox.net
Wed Dec 10 11:21:40 PST 2008


my solution to this problem was to put an onload handler on the <body> tag:
<body style="margin: 1px; padding: 1px;" onload="focusApp();">

and the script:
        <script language="JavaScript">
            function focusApp()
            {
                if ( typeof(console) != "undefined" )
                    console.debug( "focusing app..." ) ;
                var e = document.getElementById( "lzapp" ) ;
                if ( typeof(console) != "undefined" )
                    console.debug( "app element:" + e ) ;
                e.focus() ;
            }
        </script>
I develop in Firefox and I have Firebug loaded, hence the if ( 
typeof(console) != "undefined" )....console.debug(...) statements.

Brendan Fagan wrote:
> I've got a solution where a SWF8 based OL 4.1.1 app is loaded in an 
> iframe.
>
> After the app starts and the fields render, I set the focus of the 
> initial field.  The events are sent and received ok, but the if the 
> user has not clicked on the flash app, the field does not receive the 
> focus.
>
> If I do this in DHTML, the initial field receives the focus correctly 
> when the app starts, but focustrap fails to work, which isn't attractive.
>
> Is there a way to give the flash app focus after calling 
> lz.embed.swf()?  Is it worth filing in JIRA?


More information about the Laszlo-user mailing list