Flash CS5.5 and AS3 – Giving keyboard focus to an embedded Flash movie

Add to the beginning of the <body> tag, the onload event handler for your flash object. When the page is produced in the browser, the focus should now be on the flash object.

<body onload="window.document.someflashfile.focus();">
        <div id="flashContent">
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400"
                id="BibleTests" align="middle">
                <param name="movie" value="http://www.somewebsite.com/someflashfile.swf" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#cc99ff" />
                <param name="play" value="true" />
                <param name="loop" value="true" />
                <param name="wmode" value="window" />
                <param name="scale" value="showall" />
                <param name="menu" value="true" />
                <param name="devicefont" value="false" />
                <param name="salign" value="" />
                <param name="allowScriptAccess" value="sameDomain" />
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="http://www.somewebsite.com/someflashfile.swf"
                    width="550" height="400">
                    <param name="movie" value="http://www.somewebsite.com/someflashfile.swf />
                    <param name="quality" value="high" />
                    <param name="bgcolor" value="#cc99ff" />
                    <param name="play" value="true" />
                    <param name="loop" value="true" />
                    <param name="wmode" value="window" />
                    <param name="scale" value="showall" />
                    <param name="menu" value="true" />
                    <param name="devicefont" value="false" />
                    <param name="salign" value="" />
                    <param name="allowScriptAccess" value="sameDomain" />
                    <!--<![endif]-->
                    <a href="http://www.adobe.com/go/getflash">
                        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
                            alt="Get Adobe Flash player" />
                    </a>
                    <!--[if !IE]>-->
                </objectgt;
                <!--<![endif]-->
            </objectgt;
        </divgt;
     </body>

Leave a Reply