Closed (fixed)
Project:
swfobject
Version:
master
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2006 at 08:12 UTC
Updated:
7 Dec 2006 at 21:14 UTC
The following advanced parameter must be set using the SWFObject, if one uses Flash 8 (and 9) ExternalInterface :
name = allowscriptaccess
value = always
As it is this parameter cannot be set with the swfobject module.
Since Flash 8 ExternalInterface is the standard way of having Flash talk to Javascript and have Javascript talk to Flash, rather than the old deprecated fscommand. It is also so MUCH more powerful.
Comments
Comment #1
Chill35 commentedI am very familiar with the use of the swfobject library.
(http://www.blog.deconcept.com/swfobject/)
I know that the "allowscriptaccess" parameter must be set using the SWF method "addParam()" AFTER the creation of the Flash Object, on that object.
Here is a dirty trick to add the required parameter to make Flash ExternalInterface work :
add this line :
$output .= "$id.addParam('allowscriptaccess','always');\n";after line 294 of swfobject.module (outside of the loop...)
The long and clean way would be to let the Drupal admin choose to add that parameter or not, which requires a little more work, i.e. adding that option in the collapsable & collapsed advanced menu of the configuration of the swfobject block.
Comment #2
Chill35 commentedFrom "Web Design in a Nutshell" :
I can't remember for the life of me why "same" had not worked for me way back when I was testing ExpernalInterface with the SWFObject (from Geoff Stearns).
I also tested the UFO object which works reaallllllly welll, it is simpler than SWFObject AND IT IS OPEN SOURCE. :
http://www.bobbyvandersluis.com/ufo/
Comment #3
Chill35 commentedAfter line 195 of swfobject.module, that is after this line :
);Add the following block of code :
$form['opt']['swfobject_allowscriptaccess_'. $delta] = array(
'#type' => 'select',
'#title' => t('Allowscriptaccess'),
'#description' => t('This attribute controls the Flash movie\'s ability to access JavaScript on the HTML page containing the Flash movie. Flash can call JavaScript using fscommand( ) or getURL( ) within the Flash movie, or using the Flash 8 ExternalInterface class.
'),
'#default_value' => variable_get('swfobject_allowscriptaccess_'. $delta,'never'),
'#options' => drupal_map_assoc(array('never','sameDomain','always')),
);
Comment #4
Chill35 commentedOups...
Here I go again :
Comment #5
Chill35 commentedI forgot something :
This line :
must be changed to that line :
I tested it and it works great.
Comment #6
Chill35 commentedMy posts no 4 and 5 ARE the clean change.
Post no 1 suggestion, a.k.a. the dirty fix, is really not suitable as it hard-codes the parameter.
I'd love to see this added to the module.
I unfortunately don't have time to create a patch myself, I hope that somebody else will!
Comment #7
Chill35 commentedComment #8
Chill35 commentedAccording to Macromedia (http://www.adobe.com/devnet/flash/articles/external_interface_print.html) :
I tested ExternalInterface with Flash in Drupal using the swfObject module without any change to it, and it worked grrrreat. I will test more if I get more time.
So Macromedia is right : in both Firefox and IE 7, in Windows, the default allowscriptaccess property is set to sameDomain, so there's no need to set it in Drupal. ("sameDomain" is the way to go when one uses ExternalInterface, even on a local machine, given that there's a server).
I confirm that without a server, it won't work. But then Drupal won't work either. So that's not an issue.
Sorry for that! I was wrong.