[Xerte] Re: Setting Focus on the SWF

Dave Burnett d_b_burnett at hotmail.com
Thu Jul 21 13:16:14 BST 2011

This one that you sent seems quite simple: á
import flash.external.ExternalInterface;
ExternalInterface.call("s = function() { document.getElementById('mymovie').focus(); }");
áwhere 'mymovie' is ID of embedded swf object in html script.

I added the script to the SWF but I'm not sure about the ID. áDo I put the name of the swf, without the .swf extension in place of mymovie? áIf that is correct then I tried it and it didn't work.

The code is sayingExternalInterface  // talk to the DOM (Document Object Model, in this case the html page) you are embedded in
document.getElementById('mymovie').focus(); // find the element in the html with id x and give it focus.
So look in the html and get the id of the object holding the Xerte .swfIt varies depending on how you are deploying, e.g. I think if it is packaged for scorm the object is <div id="sco"so the ID you are after is "sco".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110721/b389264a/attachment.html>

More information about the Xerte mailing list