1) You'll want to set both the id and name properties in the attributes
object to ensure you can access the object from all browsers.
2) You have a $ sign in "attributes$" which needs to be removed
3) If you require FP11 for your movie, you'll want to set the required
version to "11.0.0", not "9.0.0"
4) focusing to a Flash object (a defocusing) is a real pain. In order to get
it to work correctly in a recent project, I ended up using ExternalInterface
to have the swf call a javascript focus method on itself when it loaded so
that I could ensure that everything was actually ready and available before
trying to focus it.
I tried using the swfobject callback function (which gives you the swf dom
reference etc) but on some browsers, it was still too early to focus
reliably...
(basically I think you are calling the focus() method way too early...)
Here is how I got mine to work:
1) set attributes (including tab order to allow focus to happen properly)
var _id = "someuniqueid";
var attributes = {};
attributes.id = _id;
attributes.name = _id;
attributes.tabindex = "0";
2) pass same _id into flashvars
var flashvars = {};
flashvars._id = _id;
3) Call js focus method using ExternalInterface from within swf
// in swf (as part of init() etc)
import flash.external.ExternalInterface;
// if AS3, you need to grab the flashvars from the params object. If AS2,
then these two lines are not required
var flashvars : Object = LoaderInfo(this.root.loaderInfo).parameters;
var _id : String = flashvars._id;
ExternalInterface.call("setFocus", _id);
//js method defined on HTML page which is called by Flash
function setFocus(id){
var f = document.getElementById(id);
f.focus();
}
Tested as working in FF/Safari/IE/Chrome/Opera...
Cheers,
Aran
On Wed, Oct 19, 2011 at 2:51 AM, Jean-Marc Paratte <[email protected]>wrote:
> Here is a partial code:
>
> var attributes = {
> id: "flashpanoramaplayer"
> };
>
> swfobject.embedSWF(
> "/fpp/pano.swf", "flashcontent", "100%", "100%", "9.0.0", "/include/
> swfobject_2_2/expressInstall.swf", flashvars, parameters, attributes$
> );
>
> document.getElementById('flashpanoramaplayer').focus();
>
> The last line fails.
>
> --
> You received this message because you are subscribed to the Google Groups
> "SWFObject" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en.