So if you are not proficient at coding then the simpler option I suggested
will be the way to go.

steps to get it working:

1) get both id/name correct in the attibutes object:

var attributes = {};
attributes.id = "swfContent";
attributes.name = "swfContent";



2) define focus function within <head> section which matches your id you
set for your swf:

<script type="text/javascript">
function setFocus()
{
document.getElementById('swfContent').focus();
}
</script>



3) call focus function in your <body> tag:


<body onLoad="setFocus();">


(BTW - this is not a general forum, and you will get better help on a
regular Flash forum etc. I am just answering this one as it had come up
recently before)



Cheers,
Aran




On Mon, Nov 7, 2011 at 11: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.
>
> --
> 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