I'm using swfobject.embedSWF to load show_pano.swf which is a 360° cylindrical panorama image loader which gets its parameters from alberdeen.xml (see below) loaded through flashvars.movie pano.swf. Now, I would like to load this using flashnode.

The html part underneath works perfect in a single (non-drupal) html file.

I can't get it working insite Drupal (yet) help would be much appreciated.

alberdeen.xml (which is show_pano.swf specific)

<?xml version = '1.0'?>

layer_10 = plugins/glassMeter.swf
layer_1 = plugins/limits.swf
layer_5 = plugins/autorotator.swf
layer_7 = plugins/cylConverter.swf
layer_8 = plugins/menuFullscreen.swf

panoType = cylinder
panoName = images/alberdeen

loaderText= Even geduld


hfov = 360
vfov = 110
autoLimits=1
strictBorders=0


speed = -.2
interval = 25
pause = 2000
quality = medium

Html:

This content requires Adobe Flash Player and a browser with JavaScript enabled.
var so = new SWFObject("plugins/show_pano.swf", "pano", "100%", "100%", "6.0.65", "#282828"); so.addVariable("movie", "plugins/pano.swf?xml_file=alberdeen.xml"); so.addVariable("redirect", window.location); so.addParam("allowFullScreen","true"); so.addParam("allowScriptAccess","sameDomain"); so.write("flashcontent");

An example of a working 360° panorama can be found here: (IE outside Drupal)

http://www.100it.be/pano-demo/alberdeen.html

thanks for any help in getting this working inside Drupal using flashnode. I'm new to Drupal, not to javascript && php.

chris.

Comments

dman’s picture

First, use [code] tags if you are pasting tricky stuff.

Second, this is probably a common known problem with flash and relative paths. A parameter like xml_file=alberdeen.xml will go looking for the xml relative to the apparent URL of the page it's embedded in eg in node/7 will go looking for node/alberdeen.xml or if you've given it a/custom/path Flash will look for a/custom/alberdeen.xml
This is almost never what you want.

The best-practice solution is to design your SWF so it can take a data file 'base' parameter as an extra flashvar and work from there.
You can also try passing a locally-justified path (/sites/default/files/flashdata/alberdeen.xml) BUT that often just defers the problem if the XML data doesn't in turn use good paths when pointing to other resources (eg your 'plugins').
A quick fix is to come up with some server-side redirect or alias to catch the odd links, but that's short-sighted unless you know what you are doing.

Anyway - you will learn something by looking at your 404 logs which will show you the bad requests. From there you can figure out a solution that's right for you.

Stuart Greenfield’s picture

Check this documentation page which describes various strategies for referring to external files such as xml. That documentation page also links to this example on my website that illustrates the use of a "player" (in this case an image rotator) that calls external xml.

If it did work on a non-Drupal site, and doesn't work in Drupal, then it is almost certainly a path problem, so you just need to work out where to put things. The link above should help. Flash node defaults the base parameter to your file system default directory (since it assumes you might use the upload module to attach additional files).

If in doubt, check the source code for your page and that will tell you where base is pointing, and try putting your external xml at that location.

@dman - With flash I think unqualified references are taken relative to the page that is loading the flash. In the case of Drupal everything is loaded from index.php so in the absence of a base setting then external files are assumed to be in the root, unless base is set. You don't need to explicitly code for base as a flash var. You can pass it is a parameter to the flash player itself, and then any unqualified references are automatically "expanded" with no additional coding.

IT100’s picture

Status: Active » Fixed

referring with inclusion of sitename/path/file on the different files needed did the job on both swfObject version 1.5 & 2.1 methods.
Thanks for pointing me in right direction & solving the demand for loading flash swf's the easy way!
Keep up the good work,
Regards,
Chris.

dman’s picture

With flash I think unqualified references are taken relative to the page that is loading the flash. In the case of Drupal everything is loaded from index.php so in the absence of a base setting then external files are assumed to be in the root, unless base is set.

The path would be assumed relative to the site root ... yeah ... unless you have clean URLs on.
The flash embed on the page is only aware of the current URL displayed in the location bar, not rewrites that happened on the server.
Evidence is in the 404 logs.

But it's good that there are now standard ways of handling it in flashnode.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.