PULLING MY HAIR OUT....

I'm using SWFTools to load Flash into blocks. Its awesome! Having different Flash pieces in the same place on different pages is greatness! I am running into a problem though:

I'm having a problem with a swf file not operating correctly on both

http:// and http://www

. The file displays on both; however, the script (specifically clicking a button in the flash movie to invoke a getURL) will only work on

http://

and will not work on

http://www

.

I have 'allowscriptaccess' set to 'samedomain'. If I change this to 'always', the swf functions normally then. Inside the SWFTools File Locations dialog within Drupal 6 I notice the base path is set as follows:

Media directory url:

http://mysite.com/sites/default/files

I've attempted to over ride the base URL via the suggestion contained in that dialog with $config = array, in the settings.php file, default.settings.php, as well as trying to overide the path using PHP in the block, with the PHP filter engaged, etc......

....to no avail. The install seems to remember (cache?!?) my previous settings no matter what. I've disabled and re-enabled swftools, swfobject2, cleared the system cache from the performance page, ran update.php, etc....

...The swftools media directory URL just stays the same.

What I'm trying to accomplish is to not have the swf's path be set within the object tag as "http://mysite.com/sites/default/files/header.swf", but rather be set to "/sites/default/files/header.swf" so that I can set the 'allowscriptaccess' param to 'samedomain' and the swf script work whether it is

http://mysite.com or http://www.mysite.com

.

I hope this made sense.

Can anyone help?

Thanks!

Comments

yt2s’s picture

How can the SWFTools base media directory URL be changed?

YT2S

nerkn’s picture

did you solved?

pam.pkrweb@gmail.com’s picture

Hi I looking for the same solution. Any answer?

solidreign’s picture

I had the same problem recently.

First off, a drawback to this solution is that the <> embed code generated by my JW media player (player-viral.swf) doesn't work on other websites, so if you want your video to be embeddable, you need to make sure the media directory is an absolute url (beginning with "http://").

Ok, if your hosting allows you to have direct access to your mySql database (most do using phpMyAdmin), you can change that variable directly. Once you log in to phpMyAdmin, you'll see some menu items on the left, the database(s) used by drupal and possibly others. Drupal's database has maybe a few dozen tables in it, and most modules also create a table to store data. The tables include 'cache, comments, node, permission, etc' but the one you're looking for is called 'variable'. If you click the little box next to 'variable' you can browse the many rows in that table.

Now up near the top, center of the page is an 'Insert' button that will create a new row, threby defining a new variable. You want the 'name' value to be "swftools_media_url" (without quotes).

The 'value' field is a little strange. Count the number of characters in your desired media directory, and we'll call that number x, so for "/sites/default/files" x=20. The 'value' value would be
s:20:"/sites/default/files"; - which defines a string of 20 characters.
I believe you must have the preceding "/" which refers to your Drupal root directory.

I'm using s:27:"/sites/default/files/videos"; and my [swf file="whatever.flv"] tags point to that folder.

Refresh the Administer › Site configuration › SWF Tools › File handling page and you should see the change.

(p.s. The word "character" has 9 characters. "I like characters.." has 19 characters (even white space is a




character.

I will not apologize for my love of characters nor empty space ; ))