@Philip.

Thanks for your input / background articles.

Unfortunately in my own recent findings, using the callback function
provided by SWFObject still fails to focus the element correctly in a bunch
of browsers (my hypothesis is that it is still too early to be able to
focus correctly)

I agree that this would have been a really nice clean way to make it happen
(if it had worked)


A



On Mon, Nov 7, 2011 at 12:19 PM, Philip Hutchison <platelu...@gmail.com>wrote:

> Traditionally, only links and form controls can receive focus. Since
> <object> is not a link or form element, it isn't capable of receiving focus
> in most browsers unless you set its tabIndex property.
>
> Jonathan Snook wrote a nice overview about focus and tabIndex a while back:
>
> http://snook.ca/archives/accessibility_and_usability/elements_focusable_with_tabindex
>
> The MDN has a good overview of the topic as well:
>
> https://developer.mozilla.org/en/Accessibility/Keyboard-navigable_JavaScript_widgets
>
> W3C's word on the topic (as relates to ARIA):
> http://www.w3.org/WAI/PF/aria-implementation/#keyboard-focus_tabindex
>
> As far as it relates to SWFObject, I'd invoke focus() using SWFObject's
> callback function since it doesn't involve editing the SWF:
>
>
> <script type="text/javascript">
> var flashvars = {};
> var params = { menu: false, salign: "tl", bgcolor: "#F7ECDA" };
> var attributes = { id: "swfContent" };
> var callbackFn = function(e){
>    if(e.success){
>       e.ref.tabIndex = "-1";
>       e.ref.focus();
>    }
> };
>
> swfobject.embedSWF("VendMach.swf", "flashDiv", "1152", "864",
> "9.0.0", "expressInstall.swf", flashvars, params, attributes, callbackFn);
> </script>
>
>
> By the way, setting params.quality = "best" is not necessary -- "best" is
> Flash's default setting.
>
>
> - philip
>
>
>
>
> On Mon, Nov 7, 2011 at 10:02 AM, Aran Rhee <aran.r...@gmail.com> wrote:
>
>> @Alex - Using the ExternalInterface methodology of calling focus from
>> within the swf after it is rendered etc (as described in my first response)
>> worked in all recent versions of FF/Safari/IE/Chrome/Opera that I tested.
>>
>> Setting the tab index seemed to fix the focus issue on some versions.
>>
>> In my situation, I needed not only to focus the swf on page load (kiosk
>> app driven by keyboard / remote control), but needed to be able to defocus
>> the Flash so the swap browser tab shortcut worked on FF as well... It was
>> pretty annoying to get working, but boiled down to some pretty simple
>> functions in the end...
>>
>>
>> Cheers,
>> Aran
>>
>>
>>
>>
>> On Mon, Nov 7, 2011 at 11:54 AM, Alex Harui <aha...@adobe.com> wrote:
>>
>>> Which browser and version of the browser?  I am under the impression that
>>> the focus() call doesn't work on all browsers.
>>>
>>>
>>> On 11/7/11 9:33 AM, "tidybox" <tidy...@hotmail.co.uk> wrote:
>>>
>>> > Thanks for the quick response and I have tried both your suggestions
>>> > but still not working!
>>> > I'm not the best at coding and my original code doesn't seem to
>>> > reflect your suggestions so maybe I'm altering it incorrectly (I used
>>> > the air swfObject2 generator)!
>>> > Here is my HTML code before adding any of your stuff and maybe you can
>>> > point me in the right direction as to where to place the new code.
>>> >
>>> > Much appreciated
>>> >
>>> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
>>> > www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>> > <html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
>>> > <head>
>>> > <title>Portfolio</title>
>>> > <meta http-equiv="Content-Type" content="text/html;
>>> > charset=ISO-8859-1" />
>>> > <script type="text/javascript" src="swfobject.js"></script>
>>> > <script type="text/javascript">
>>> > var flashvars = {};
>>> > var params = {};
>>> > params.menu = "false";
>>> > params.quality = "best";
>>> > params.salign = "tl";
>>> > params.bgcolor = "#F7ECDA";
>>> > var attributes = {};
>>> > attributes.id = "swfContent";
>>> > swfobject.embedSWF("VendMach.swf", "flashDiv", "1152", "864",
>>> > "9.0.0", "expressInstall.swf", flashvars, params, attributes);
>>> > </script>
>>> > <style type="text/css" media="screen">
>>> > object { outline:none; }
>>> > <!--
>>> > body {
>>> > background-color: #F7ECDA;
>>> > margin-left: 0px;
>>> > margin-top: 0px;
>>> > margin-right: 0px;
>>> > margin-bottom: 0px;
>>> > }
>>> > -->
>>> > </style>
>>> > <meta name="Keywords" content="Graphic Designer, Graphic Design,
>>> > Photoshop, illustrator, animation, print work, design, inDesign,
>>> > freelance" />
>>> >     <meta name="Description" content="MyPortfolio, freelance graphic
>>> > designer" />
>>> > </head>
>>> > <body>
>>> > <div id="flashDiv">
>>> > <a href="http://www.adobe.com/go/getflashplayer";>
>>> > <img src="http://www.adobe.com/images/shared/download_buttons/
>>> > get_flash_player.gif" alt="Get Adobe Flash player" />
>>> > </a>
>>> > </div>
>>> > </body>
>>> > </html>
>>> >
>>> > ____________________________________________________________________
>>> >
>>> > On Nov 7, 4:20 pm, Aran Rhee <aran.r...@gmail.com> wrote:
>>> >> Have a read of my reply to this question in this thread:
>>> >>
>>> >>
>>> http://groups.google.com/group/swfobject/msg/b0dc02d06db7aa43?hl=en_US
>>> >>
>>> >> That in my opinion is the correct way to do it (as you can ensure the
>>> focus
>>> >> (and defocus) calls work as intended)
>>> >>
>>> >> A simpler way which works in *most* browsers is to call a function on
>>> page
>>> >> load. Set the name and id in your attributes object for your
>>> embedSWF()
>>> >> call, and then call the focus method once all the page content had
>>> loaded.
>>> >>
>>> >> <head>
>>> >> <script type="text/javascript">
>>> >> function setFocus()
>>> >> {
>>> >> document.getElementById('myflashid').focus();}
>>> >>
>>> >> </script>
>>> >> ...
>>> >> </head>
>>> >>
>>> >> <body onLoad="setFocus();">
>>> >>
>>> >> Aran
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On Mon, Nov 7, 2011 at 10:09 AM, tidybox <tidy...@hotmail.co.uk>
>>> wrote:
>>> >>> I have an HTML page with only a single flash object on it which is
>>> >>> embedded using the 2.1 swfObject "Dynamic" generator and I want to be
>>> >>> able to use the keyboard straight away without the user first having
>>> >>> to click on the flash movie first! Can anyone advise me what code I
>>> >>> should use and where should it be placed in the generated HTML??
>>> >>
>>> >>> Thanks
>>> >>
>>> >>> --
>>> >>> You received this message because you are subscribed to the Google
>>> Groups
>>> >>> "SWFObject" group.
>>> >>> To post to this group, send email to swfobject@googlegroups.com.
>>> >>> To unsubscribe from this group, send email to
>>> >>> swfobject+unsubscr...@googlegroups.com.
>>> >>> For more options, visit this group at
>>> >>> http://groups.google.com/group/swfobject?hl=en.
>>>
>>> --
>>> Alex Harui
>>> Flex SDK Team
>>> Adobe System, Inc.
>>> http://blogs.adobe.com/aharui
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "SWFObject" group.
>>> To post to this group, send email to swfobject@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> swfobject+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/swfobject?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "SWFObject" group.
>> To post to this group, send email to swfobject@googlegroups.com.
>> To unsubscribe from this group, send email to
>> swfobject+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/swfobject?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "SWFObject" group.
> To post to this group, send email to swfobject@googlegroups.com.
> To unsubscribe from this group, send email to
> swfobject+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/swfobject?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to swfobject@googlegroups.com.
To unsubscribe from this group, send email to 
swfobject+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en.

Reply via email to