Jump to content


Is prependedURLs applied to alternateURL ?

Recommended Posts

Im using an XML loader to load in some images, xml is as below:


]]> </contentTextField> <br />		</ImageLoader><br />			<br />		<ImageLoader name="Yellow" url="images/yellow.png" alternateURL="images/yellow.png" load="true"><br />			<contentTextField><![CDATA[ 

]]> </contentTextField> <br />		</ImageLoader><br />				 <br />		<ImageLoader name="Red" url="images/red.png" alternateURL="images/red.png" load="true"><br />			<contentTextField><![CDATA[ 


Because the swf & xml will be uploaded to several locations on a server I am prepending the urls with the string imagesFilePath


var xmlFilePath:String = root.loaderInfo.url.replace(".swf",".txt"); //get filepath to load xml
var imagesFilePathAry:Array = root.loaderInfo.url.split('/');
var imagesFilePath:String = ""; //get path to images
for (var i = 0; i < imagesFilePathAry.length -1; i++)
imagesFilePath += imagesFilePathAry[i];
imagesFilePath += "/";


The problem is that it fails to load the images on my work computer as it can't find the files, at home it's fine, uploaded to the server is fine.


It works on the work computer when I don't prepend the urls (i.e. it is happy with the relative filepath) but then it no longer works when uploaded to the server, as it requires the full path


What I am expecting to happen is this;


On the server - it loads from the the prepended url with the full file path.

On the work computer - (for whatever reason) it can't find the images from initial url so switches to alternateURL and loads the images from the relative filepath


However it still give an IOError on the work computer so I'm assuming both the url and the alternateURL are getting prepended with the full filepath??


Any help would be greatly appreciated either with getting a filepath that will always work or getting the alternateURL to work. I've been struggling with this for the last day and half now!.

Link to comment
Share on other sites

No, as indicated in the ASDocs, prependURLs() does NOT affect any alternateURL values.


Have you traced out the path(s) you're feeding in and are you sure they're what you want? It sounds like there's something else different about your home/work computer. It's tough to tell without being able to see your code and publish the file on our end, but if you're still having trouble please feel free to post a very simple FLA that demonstrates the issue (no need to post your production files).

Link to comment
Share on other sites

Sorry for the late reply.


I was creating a simple version to upload, but when I tested it, it worked as expected and I was unable to recreate the IO error. I should also point out that this error was only appearing in Flash Player 9.


My XML was loading in another image separate from the rest, outside my images node as follows:




It turns out that by cutting and pasting that seperate ImageLoader in with the rest it allowed all the alternate Url's to work as expected.


I'm still not willing to remove my poor coding skills as a probable cause of the failure (I'm still pretty green!), but it's also likely to be FP9 being weird as usual.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.