You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialise correctly.
A few people have posted over at drupal.org asking about getting flash node working with xml files, for example, as a means of loading content in to media players or image rotators.
In most respects this is just a variation of using loadMovie and loadSound and the "trick" is knowing how Flash itself works out file paths. There's a handbook page for flash node that explains this in more detail. In a nutshell, when Flash tries to load a file with an unqualified path then the path to the file is taken relative to the page that is loading, not the swf that is loading. For Drupal that means everything is relative to index.php and it looks in the site root. That's not very elegant so Flash node helps you by supporting the base parameter. This tells Flash how to resolve paths, and in flash node by default base is set to point to your Drupal files directory. If you want to refer to a different location you are free to over-ride this for each node.
However, to make things a bit clearer (and to show that it does indeed work!), this example node is running the Wijering image rotator. The rotator consists of an swf file that handles the display, but it uses an xml file to define the content.
To make this node work I have created a flash node and given it the image_rotator.swf file as the content. This file has been put in /files/flash.
Then, using the upload module, I have attached an xml file (demo.xml) and the three images that will be called (hope Microsoft don't mind me using their Vista sample images!) As a result of using the upload module all of those files have ended up in the /files directory.
Flash node's default setting for the base parameter is that directory so I didn't need to change anything there.
To tell the image rotator where to find the xml file I need to set a flash variable, file=demo.xml. That goes in flash node's Flashvars field. To make things look pretty I also set the player background colour, so my final flashvars string looks like this file=demo.xml&screencolor=0xFFFFFF.
In the xml file I simply put the filename (no path) of each image file so the paths are unqualified. This means that when the xml file gets parsed and Flash tries to load the files then they are all worked out again using base and they resolve in to /files.
So, my xml looks like this...
<?xml version="1.0" encoding="utf-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<title>Forest</title>
<creator>Windows Vista</creator>
<location>Forest.jpg</location>
<info>http://www.stuartandnicola.com</info>
</track>
<track>
<title>Garden</title>
<creator>Windows Vista</creator>
<location>Garden.jpg</location>
<info>http://www.stuartandnicola.com</info>
</track>
<track>
<title>Waterfall</title>
<creator>Windows Vista</creator>
<location>Waterfall.jpg</location>
<info>http://www.stuartandnicola.com</info>
</track>
</trackList>
</playlist>So, when this page loads index.php calls image_rotator.swf. The file receives the flashvars and it goes looking for demo.xml. Because the base parameter has been set then instead of looking in the site root (where index.php is) it looks in /files.
Flash reads the xml, and as it is processed it finds the filenames. Because the filenames are unqualified the same process as for the xml occurs - the base parameter resolves the unqualified names to their proper location in /files.
And the upshot is a working image rotator without writing a line of html. I just had to prepare the xml file, create a flash node, and set a flash variables string.
I hope this helps clear things up a bit! Please leave feedback if you found this (un)helpful!
| Attachment | Size | Hits | Last download |
|---|---|---|---|
| demo.xml | 715 bytes | 824 | 3 days 13 hours ago |
Comments
Thanks for the excellent
Thanks for the excellent tutorials your site is a big help. I am, however, having trouble getting flash node working with xml files as you've gone through above. I've tried this on both my localhost and up on a shared server. First I downloaded Wijering image rotator to attempt exactly as you did. I used the xml and the 3 sample images that come with it.
iyinet frmtr trkygnclr webmaster seo yarışması
After enabling the module I created a flash node. Set my flashvars field to file=madrid.xml (this is the name of the xml I'm using) and I attached my 3 images. After I attached my 3 images and xml I saved the node but all that appears is a black little box that is attempting to load. I checked where my files were uploaded to and all is the same as yours above (I think!). My xml and images are in sites/default/files and the imagerotator.swf is in sites/default/files/flash. Any help would be much appreciated I would love to make use of this great module.
flashnode with xml not loading in Firefox and Safari
First of all thanks very, very much for your explanation. It was a tremendous help. I was finally able to get my flash movie that is XML driven to work with a flashnode in a block. However, it only works in IE and does not work in Safari and Firefox. I also tried you page with the flashnode XML example and it also does not load in Firefox. Can you offer any help on this?
Thanks
Maci
Edit xml file
Hi,
Thanks for the tutorial. Can you tell me is it possible to edit the xml file from the admin side. I am trying to change the contents of the xml file from the admin side, I would also like to upload images for the xml file.
Please let me know if that can be done.
Thank you
Deepak
Weird thing happened to me.
Weird thing happened to me. I did your great tutorial on a shared hosting and it worked perfectly, I'm using my own .swf file and my own xml file. Then I moved the whole site to my localhost and it didn't work, all the files were there. I thought it could be something related to permissions so I just did a chmod 777 to all my sites/default/files but nothing. Then I deleted the node and started all over again but nothing, I'm just copying exactly the settings from the shared hosting site and it isn't working.
Then I say the code, in my shared hosting I get two tags, and only one in my localhost, what could go wrong if things aren't working the way it should?
Thanks again.
Duplicate XML files
What happens if there is already a demo.xml file in your /files folder? demo_0.xml will be created and your swf will point to the wrong file right? What's the best way to avoid this issue?
Use a flashvar
In the example above you tell the rotator what file to use via the
fileflashvar, so if you inspect the source of this page you'll findfile=demo.xml. You'd change that to point to another file.You can use this method in your swf movies if you think you'll need to be able to accommodate multiple xml files.
how to do the same thing wihout flash node
Hi all,
I am a drupal account user. I can't change and add anything to drupal setup code. I mean , I can't load the flash module to drupal.
But I want to load a flash gallery to my site. How can I achive this?
How can I relate the swf and xml in drupal page? I tried sevral things buut nothing happened. This is very important. Please help...
Helpful Info
I am a newbie in Drupal. It has really helped me alot. Thanks alot!
Help!
Hey,
Thanks for the excellent tutorials your site is a big help. I am, however, having trouble getting flash node working with xml files as you've gone through above. I've tried this on both my localhost and up on a shared server. First I downloaded Wijering image rotator to attempt exactly as you did. I used the xml and the 3 sample images that come with it.
After enabling the module I created a flash node. Set my flashvars field to file=madrid.xml (this is the name of the xml I'm using) and I attached my 3 images. After I attached my 3 images and xml I saved the node but all that appears is a black little box that is attempting to load. I checked where my files were uploaded to and all is the same as yours above (I think!). My xml and images are in sites/default/files and the imagerotator.swf is in sites/default/files/flash. Any help would be much appreciated I would love to make use of this great module.
To tell the image rotator
To tell the image rotator where to find the xml file I need to set a flash variable, file=demo.xml. That goes in flash node's Flashvars field. To make things look pretty I also set the player background colour, so my final flashvars string looks like this file=demo.xml&screencolor=0xFFFFFF.
I've played arround with the
I've played arround with the XML-RPC Client for ActionScript and implemented an example which allows following xml methods:
- node.load
- node.save
- user.login
- system.connect
The flash app supports api_key and sessid, please make sure that they are enabled in you drupal xmlrpc service.
Flash node xml example
<swflist player="wijering_imagerotator" files="/st/st001.jpg&&/st/st002.jpg&&/st/st003.jpg&&/st/st004.jpg&&/st/st005.jpg" width="500" height="375" transition="random"></swflist>I get the XML file generated in the case files/playlists/9c21ec7fc86b8803250b64b74b68ef26.xml
and I rename : st.xml
this xml file contains links absolute to my photo
I put the st.xml in root /files on my server
and i use this code in Drupal content area :
<swf files="st.xml" width="500" height="375">and it does not work :(
I have tried using the same method in the root Files/st.xml with photos in the same directory but I do not get better results.
thank you for your help
SWF and XML
Good tutorial, but I'm not sure that applies to my case.
I have used as Create Content a-PAGE- not a FLASH NODE, with the following code:
All HTML format
<body><div class="wrap">
<div class="box">
<swf file="player.swf" width="550px" height="300px" >
</div>
<div class="boxtwo">
<swf file="albumal500.swf" width="500px" height="430px" >
</div>
</div>
My PAGE works perfectly well in FF and NOT in IE. I have two swf in the same page , one is a player loading FLVs from an XML and the second is a swf slider loading images from an XML I uderstand there is a bug and that might be my PAGE problem .
Since in Drupal the browser looks for INDEX.php in the root directory as a first path indication , why IE doesn't do that?Having my files loaded also in root directory.
Last question in the new DRUPAL 6.0 release solving these issues?
Are you using direct embedding with SWF Tools?
The <swf> tag is SWF Tools format rather than flash node, but the reason you are having a problem is probably because you are using SWF Tools direct embedding mode. There's a bug in SWF Tools that means the base parameter doesn't get passed to IE.
There are two solutions:
-
Install an SWF Tools javascript embedding method (e.g. SWF Object) - these methods support the base parameter properly in all browsers.
-
Patch your copy of swftools.module
to fix the error, pending the "official" fix to the module.If you want to do a manual patch see this thread over at drupal.org. The thread covers this issue and also gives some details about installing a javascript package for SWF Tools.
Hopefully one of the above will fix things for you.