tags:

views:

2307

answers:

2

I could barely find a reasonable title that would explain my issue, let alone try and search for how to fix this.

My issue :

1) User uploads a .zip with say: flash.swf images.xml image.jpgs

2) It gets extracted into a unique folder ID ex. /swfs/123456/

3) Server tries to load the .swf in "index.php" and the .swf tries to call the .xml file, which should be in the same directory as the .swf, thinking xml src="images.xml"

The .swf thinks the xml file is in the same folder, but I guess when HTML calls a .swf is confused of it's directory. It's looking for an xml file that doesnt exist because its looking in the same folder as index.php instead of the .swfs original folder ex. /swfs/123456/images.xml

How would I possibly tell the .swf to load an xml without knowing what the directory is, or stop html from confusing my .swf of it's original location?

*Or is it that the xml file is confused of it's location and linking to the wrong images?

+2  A: 

When embedding your swf, you could set the base attribute.

base - . or [base directory] or [URL]. Specifies the base directory or URL used to resolve all relative path statements in the Flash Player movie. This attribute is helpful when your Flash Player movies are kept in a different directory from your other files.

From: http://kb2.adobe.com/cps/127/tn_12701.html

Also see: http://kb2.adobe.com/cps/041/tn_04157.html

Hope that helps!

This is EXACTLY what I was looking for! I've tried it and it works! I already started writing an xml rewrite script but now I dont have to finish it! :D Thanks for your help guys!
askon
+2  A: 

It's looking for an xml file that doesnt exist because its looking in the same folder as index.php instead of the .swfs original folder ex. /swfs/123456/images.xml

Yes, that's exactly what is happening. You won't be able to load the XML file with the relative path (images.xml) you are using. You will need to include the full path to the XML file (/swfs/123456/images.xml)

One possible way to do this is pass your $key variable to the .swf file so you can include it in the path to the XML file. You could do something like:

www.yoursite.com/index.php?key=123456

Then grab the variable using Actionscript, and insert it into the path name for the XML file:

xml src="swfs/"+key+"/images.xml"

Does that make sense? Of course, there are other ways to pass data from PHP to Flash and plenty of resources online that discuss them. A quick Google search should find you what you need.

Colin