is embedSWF() working right with IE9 and Flash11 ?

968 views
Skip to first unread message

Jean-Marc Paratte

unread,
Oct 19, 2011, 3:51:20 AM10/19/11
to SWFObject
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.

Aran Rhee

unread,
Oct 19, 2011, 10:53:56 AM10/19/11
to swfo...@googlegroups.com
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.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




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


Reply all
Reply to author
Forward
0 new messages